Learn BigQuery
Learn BigQuery SQL for free in an interactive playground, right in the browser. No signup, no billing — write real queries against a teaching dataset and get instant feedback.
Lessons
- SELECT and WHERE
- ORDER BY and LIMIT
- DISTINCT
- NULL and IS NULL
- IN, BETWEEN and LIKE
- Expressions, aliases and CASE
- GROUP BY and COUNT
- SUM, AVG and HAVING
- COUNTIF and conditional aggregation
- MAX_BY, LOGICAL_AND and STRING_AGG
- Multiple grouping columns and GROUP BY ALL
- Subtotals and grand totals: ROLLUP, CUBE, GROUPING SETS
- Turn rows into columns: PIVOT and UNPIVOT
- UNION ALL and set operations
- INNER JOIN
- LEFT JOIN and anti-joins
- Joining on keys that can be NULL
- Self-join
- Three-table join
- EXTRACT, DATE_TRUNC and DATE_DIFF
- FORMAT_DATE and CAST
- TIMESTAMP, DATETIME and time zones
- Strings, REGEXP_CONTAINS and SAFE_CAST
- Pull text apart: SPLIT, SUBSTR, REGEXP_EXTRACT
- Numbers: INT64, FLOAT64 and NUMERIC
- Name a step with WITH
- A recursive CTE
- Scalar and IN subqueries
- EXISTS and NOT EXISTS
- Rank rows with window functions
- LAG, running counts and frames
- Frames, LAST_VALUE and named windows
- Top n per group with QUALIFY
- Percentiles and buckets: NTILE, PERCENTILE_CONT, PERCENT_RANK
- UNNEST an array of structs
- Struct fields and ARRAY_LENGTH
- Collect values with ARRAY_AGG
- Array subqueries, SAFE_OFFSET and ARRAY_TO_STRING
- Keep every row with LEFT JOIN UNNEST
- Fill in the missing days
- What a query costs
- How BigQuery skips data
- Wildcard tables
- Arrays and structs are columns
- SELECT * EXCEPT and REPLACE
- Approximate aggregates
- Read the error and fix the query
- Semi-structured data: JSON
- Columns you never needed
- Read the estimate before you run
- What clustering buys you
- INFORMATION_SCHEMA: explore a dataset
- INFORMATION_SCHEMA: how a table is stored
- Cheap previews and stable samples
- Design a table for its queries
- Read your own job history
- Filter and select in a pipeline
- Extend and aggregate a pipeline
- Join and window pipeline stages
- UNION, PIVOT and UNPIVOT as pipe steps
- DECLARE, SET and IF
- A loop, and BEGIN ... EXCEPTION
- Dynamic SQL: EXECUTE IMMEDIATE and FOR
- A temporary function
- Procedures and table functions
- CREATE TABLE AS SELECT and INSERT
- Column defaults, identity columns and keys
- UPDATE safely
- DELETE with explicit scope
- MERGE a staged batch
- MERGE conditions, NULL keys and replacing a slice
- All or nothing: transactions
- Undo a mistake: time travel and snapshots
- Save a query as a view
- Events per day
- Unpacking event parameters
- Deriving a session key
- Landing pages
- Engaged sessions
- The purchase funnel
- Revenue by item
- Attribution by channel
- Day-N retention
- The used-car buying guide
- Where the buyers came from
- The nightly reconciliation