Browse
SQL Fundamentals
SELECT, WHERE, and JOIN — retrieving and combining rows from relational tables.
What it is
SQL queries retrieve rows matching conditions and combine data across tables via joins.
Core clauses
- SELECT / FROM / WHERE — pick columns, pick a table, filter rows before any grouping happens.
- JOIN types —
INNER JOINkeeps only matching rows in both tables;LEFT JOINkeeps every row from the left table, with NULLs where there's no match on the right;RIGHT/FULL JOINfollow the same idea from the other side or both. - ORDER BY / LIMIT — sort the result set and cap how many rows come back.
Execution order (not written order)
SQL is written SELECT ... FROM ... WHERE ... GROUP BY ... ORDER BY, but conceptually executes FROM → WHERE → GROUP BY → SELECT → ORDER BY — which is why you can't reference a SELECT alias in the same query's WHERE clause.
Why it's the root of the SQL topic
Aggregation, window functions, indexing, and schema design all assume fluency with joins and filtering first — they're refinements on top of "retrieve the right rows."
