Anatomy of an SQL query
Explore the fundamental clauses of an SQL query including SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, and LIMIT. Understand the actual order in which SQL executes these clauses to better write and analyze data retrieval commands. This lesson helps you grasp the anatomy of SQL queries essential for data analysis tasks.
We'll cover the following...
We'll cover the following...
Common clauses
These are the common clauses of an SQL query:
SELECT <expressions>
FROM <tables>
JOIN <to other table> ON <join condition>
WHERE <predicates>
GROUP BY <expressions>
HAVING <predicate>
ORDER BY <expressions>
LIMIT <number of rows>
Here is a quick overview of each clause:
SELECT: It lists the columns and expressions to appear in the query result output. ...