Basic SELECT
INNER JOIN
LEFT JOIN … IS NULL
GROUP BY with COUNT, SUM, AVG
HAVING
Subqueries
Window functions (ROW_NUMBER, RANK)
CASE expressions
INSERT, UPDATE, DELETE
JOINs when combining tables.
LEFT JOIN … IS NULL for finding missing matches.
GROUP BY with COUNT, SUM, and AVG for summaries.
ORDER BY for sorting.
Need related data from another table? → JOIN
Need rows that don’t have a match? → LEFT JOIN … IS NULL
Need totals or averages by group? → GROUP BY + aggregate functions
Need to filter individual rows? → WHERE
Need to filter aggregated results? → HAVING
Need only unique values? → DISTINCT
Need ranked or running calculations? → Window functions (OVER())
“I need to join users with orders.” → Look up the exact JOIN syntax if needed.
“I need customers who haven’t placed an order.” → Search for LEFT JOIN … IS NULL.
“I need sales totals by month.” → Check GROUP BY and SUM().
“I need the top 10 products.” → Look up ORDER BY and TOP or LIMIT.