As we have already alluded to, a "query"
is a structured request to the database for data. At its core,
a query is something like, "Hey, give me a list of all the
clients in the CLIENTS table who live in the 213 area code!"
Or, in more specific terms, a query
is a simple statement (like a sentence) which requests
data from the database.
Much as is the case with English, an SQL
statement is made up of subjects, verbs, clauses, and
Let's take a look at the statement made above.
In this case, the subject is "hey you database thing".
The verb is "give me a list". The clause is "from the CLIENTS
table". Finally, the predicate is "who live in the 213 area
We'll explain the code later, but let me
show you what the above statement might look like in SQL:
SELECT * FROM CLIENTS WHERE area_code = 213
SELECT = VERB = give me a list
FROM CLIENTS = CLAUSE = from the CLIENTS
area_code = 213 = PREDICATE = who live in the 213 area