Refining What You See Using WHERE
The type of SELECT statement we’ve worked with so far retrieves all the rows from a given table and uses them in the statement’s result set. This is great if you really do need to see all the information the table contains. But what if you want to find only the rows that apply to a specific person, a specific place, a particular numeric value, or a range of dates? These are not unusual requests. In fact, they are the impetus behind many of the questions you commonly pose to the database. You might, for example, have a need to ask the following types of questions.
“Who are our customers in Seattle?”
“Show me a current list of our Bellevue employees and their phone numbers.”
“What kind of music classes do we ...
Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second 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.