While statements in SQL are commands that are executed by a SQL engine, SQL clauses are modifiers to statements that alter their behavior.
We’ve seen in the previous section how to use SQL statements and to retrieve and modify data in a SQL database. However, for most of our queries, we were limited to returning or altering all the data from a table or that was the result of a statement. SQL clauses are the next most fundamental part of the language.
Most SQL clauses are optional, however there are some that are essentially mandatory in order to execute a statement with a desired result; for example, using a
GROUP BY clause with a
SELECT statement which uses aggregation functions not applied over a whole table or result set.
Additionally, most SQL clauses are associated with particular SQL statement types, as we see above with the
GROUP BY clause. The SQL clauses we will cover in this section are those most frequently used, and so are mainly to alter the behavior of SQL queries using
Learn SQL Today
Get hands-on experience writing code with interactive tutorials in our free online learning platform.
- Free and fun
- Designed for beginners
- No downloads or setup required