Translating Your Request into SQL
When you request information from the database, it’s usually in the form of a question or a statement that implies a question. For example, you might formulate statements such as these:
“Which cities do our customers live in?”
“Show me a current list of our employees and their phone numbers.”
“What kind of classes do we currently offer?”
“Give me the names of the folks on our staff and the dates they were hired.”
After you know what you want to ask, you can translate your request into a more formal statement. You compose the translation using this form:
Select <item> from the <source>
Start by looking at your request and replacing words or phrases such as “list,” “show me,” “what,” “which,” and “who” with ...
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.