Chapter 4
The WHERE
Clause
The WHERE
clause is the second clause of the SQL SELECT
statement that we’ll now discuss in detail. The FROM
clause, which we covered in the previous chapter, introduced the central concept behind SQL: tabular structures. It is the first clause that the database system parses and executes when we run an SQL query. A tabular structure is produced by the FROM
clause using tables, joins, views, or subqueries. This tabular structure is referred to as the result set of the FROM
clause.
The WHERE
clause is optional. When it’s used, it acts as a filter on the rows of the result set produced by the FROM
clause. The WHERE
clause allows us to obtain a result set containing only the data that we’re really interested in, ...
Get Simply SQL 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.