SQL Fundamentals
SELECTs, joins, group-bys, subqueries, CTEs. The core vocabulary.
Self-joins without the headache: a sql self join example that sticks
A self-join is a normal join where a table is compared against itself. It looks scary until you give the two copies different names, then it's just a join like any other.
Subqueries vs CTEs: a query inside a query, made readable
Both let you use the result of one query inside another. A CTE just gives that inner query a name up front, so the whole thing reads top to bottom instead of inside-out.
String & date functions: cleaning and slicing the messy columns
Real data is full of messy text and dates. A handful of built-in functions (LOWER, TRIM, DATE_TRUNC, EXTRACT) cover most of what an analyst does day to day.
Aggregate functions: COUNT, SUM, AVG and their sharp edges
The functions that turn many rows into one number look simple, but COUNT(*) vs COUNT(column), and how they treat blanks, is a favourite beginner interview question.
Data types & casting: why '10' + 5 sometimes breaks
Every column has a type: text, number, date, true/false. Knowing the type matters because a number stored as text won't add up, and comparing across types causes subtle bugs.
NULL handling: what 'blank' really means in SQL
NULL isn't zero and isn't an empty string, it means 'unknown.' And comparing anything to 'unknown' gives you 'unknown,' which quietly drops rows you expected to keep.
DISTINCT, LIMIT, aliases & ordering: the small everyday tools
Four little tools you'll use in almost every query: remove duplicates, cap the rows, rename columns, and sort by more than one thing.
UNION, INTERSECT, EXCEPT: stacking query results on top of each other
A JOIN adds columns side by side. These stack the rows of two queries into one list: combine them, keep only the overlap, or subtract one from the other.
The five JOIN types: sticking two tables together
A JOIN glues two tables side by side where a shared column matches. The five types just differ on what happens to rows that don't find a match.
GROUP BY & HAVING: turning many rows into one summary row
GROUP BY rolls many rows up into one summary per group. HAVING filters those summaries. The classic beginner mix-up is using WHERE where you needed HAVING.
SELECT, WHERE, ORDER BY: the three words in almost every query
Every SQL query you'll write starts with picking columns, filtering rows, and sorting the result. Get comfortable with these three and you can read most queries.