Choose the source
FROM identifies the table or result to process.
Understand SQL through how data changes. Switch Snowflake / BigQuery to explore the same concepts in the same order.
Core SELECT syntax for querying and analysis. Find a purpose or syntax name and compare results on the same input.
FROM identifies the table or result to process.
WITH and a subquery in FROM can express the same intermediate result.
Matches / all left / all from both / every combination.
In a LEFT JOIN, moving the condition changes which rows survive.
Expand elements of a composite value into more rows.
WHERE before aggregation; HAVING after aggregation; QUALIFY after windows.
Choose what to count or which summary to calculate.
GROUP BY defines aggregation units; DISTINCT removes duplicate selected rows.
Aggregate: N rows → one per group. Window: N rows → N rows.
Unique sequence / ties with gaps / ties without gaps.
Attach the preceding and following values in the same order.
ROWS uses row positions; RANGE uses ordering values.
Comparisons return TRUE, FALSE or NULL; logical operators combine them.
Equality with NULL is unknown. Test with IS NULL.
CASE supports multiple conditions; IF / IFF is compact for two outcomes.
Unconvertible value: CAST errors; the safe version returns NULL.
ABS returns magnitude; ROUND rounds to the specified precision.
Apply four operations to the same string.
The operation is shared; argument order and unit syntax differ.
Both may display 7, but their types differ.
One A and B: keep duplicates / remove them / common values / left only.
Match names even when column positions differ.
Deduplicate → sort → skip initial rows → take up to the limit.