LESSON 4Clauses in SQL Queries

This lesson’s topic is clauses. Clauses are the piece of the SQL statement that grant you fine grained control over your result set. By the end of this lesson, you will understand and be able to use the following clauses:

WHERE

ORDER BY

GROUP BY

HAVING

To get a feel for where these functions fit in, examine the general syntax of a SELECT statement:

Syntax image

image

The MySQL equivalent is

Syntax image

Get Sams Teach Yourself SQL in One Hour a Day, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.