Practice the exact SQL patterns Google asks in L3-L6 data analyst and data engineer interviews. Window functions, CTEs, BigQuery-style queries, and optimization — with AI tutoring.
32 challenges
Google patterns
AI tutor
Explains every step
No setup
Runs in browser
What this page is: we have no dated public source for how Google runs its SQL round, so this page does not state one — no duration, no platform, no stage list. What follows is general SQL interview practice on the kind of data Google works with. What is ours: the questions are SQL Quest challenges and the topic emphasis is our editorial judgement, not a measured breakdown of Google's interview. Pages with dated sources say so in this spot.
The 32 challenges tagged Google in the SQL Quest bank, with every raw challenge tag resolved to the 9 canonical skills. Each share is the portion of those 32 challenges that exercise the skill — a challenge exercises several, so the shares do not sum to 100%. This is the composition of the practice set on this page, not a measurement of Google’s interview.
These are SQL Quest challenges chosen because their SQL matches the work — Querying Basics, Subqueries & CTEs, Aggregation & Grouping. They are not questions Google has asked, and this page does not claim to know its questions. All of the six play free; each card opens the challenge itself.
Analyst Round
Updated September 2026 · the outputs below come from the same datasets the editor runs
Two shapes account for most of the window-function questions in analyst-style SQL rounds: rank inside a group (top-N per group, dedupe, second-highest per department) and compare a row with its neighbour (month-over-month, streaks, gaps). Both are below, and both run in the editor exactly as written.
The pattern that shows up in analyst-round questions as "the best / latest / second-highest X for every Y". Number the rows inside each partition, then keep the numbers you want. The WHERE rn <= 2 has to live outside the window — a window function cannot be filtered in the same SELECT that defines it, which is why the CTE is there.
WITH ranked AS ( SELECT name, department, salary, ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) AS rn FROM employees ) SELECT department, name, salary, rn FROM ranked WHERE rn <= 2 ORDER BY department, rn
| department | name | salary | rn |
|---|---|---|---|
| Engineering | Ulysses Cook | 115000 | 1 |
| Engineering | Eva Martinez | 110000 | 2 |
| Finance | Teresa Murphy | 98000 | 1 |
| Finance | Paul Thompson | 95000 | 2 |
The trap is ties. ROW_NUMBER breaks them arbitrarily and always returns exactly N rows per group; DENSE_RANK lets tied salaries share a rank, so "second highest" can return two people. Say which one the question wants before you write it — that sentence is usually worth more than the query.
Second-Highest Earner Per Department (ROW_NUMBER)
The query above with a deterministic tiebreaker in the ORDER BY.
Second Highest Salary per Department
Google-tagged. The DENSE_RANK version, where ties share a rank.
The pattern behind every "how did this month compare to last month" question: aggregate to one row per period first, then reach back one row with LAG. Doing the LAG over raw orders compares orders, not months — the GROUP BY has to happen in the first CTE.
WITH monthly AS ( SELECT strftime('%Y-%m', order_date) AS month, SUM(total) AS revenue FROM orders GROUP BY 1 ), with_prev AS ( SELECT month, revenue, LAG(revenue) OVER (ORDER BY month) AS prev_revenue FROM monthly ) SELECT month, revenue, prev_revenue, ROUND(100.0 * (revenue - prev_revenue) / prev_revenue, 1) AS mom_pct FROM with_prev ORDER BY month
| month | revenue | prev_revenue | mom_pct |
|---|---|---|---|
| 2024-01 | 4471.81 | NULL | NULL |
| 2024-02 | 3684.63 | 4471.81 | -17.6 |
The trap is the first row. LAG has nothing to look back at, so prev_revenue is NULL and the division comes out NULL rather than erroring — which is fine, as long as you say so. The same two-step (period aggregate, then LAG) is also how consecutive-day streaks and gap detection start; only the PARTITION BY changes.
Google-tagged window-function challenges in the set · 8 of 32 · all Hard, Pro
Salary Percentile Ranking (PERCENT_RANK) · 3-Movie Rolling Average Revenue (ROWS BETWEEN) · Fare Percentile Ranking (NTILE) · Engagement Streaks (LAG, gaps and islands) · Median Salary Without PERCENTILE (ROW_NUMBER) · Customer Lifetime Value Pipeline (NTILE) · Department Salary Percentile Buckets (NTILE) · Second Highest Salary per Department (DENSE_RANK)General guidance about analytics SQL work — not sourced from Google and not a description of its process. We have no dated, citable source for how Google runs its SQL round, so this page states none.
Skillmap
Ten questions, no signup. You get a readiness score weighted to the SQL this page covers, your Skillmap across joins, window functions, aggregation and the rest, and the weakest skill to practise first.
Drill the skills the Google set leans on, one at a time: CTE practice · GROUP BY exercises · Window function practice · JOIN practice · CASE WHEN practice — or browse every SQL practice question.
Every question in the Google set, one page each with the schema and a hint: Long-Named Passengers · Department Roster with GROUP_CONCAT · Consistent Director Analysis · Below Department Average · Highest Total Salary Budget Department · Title Social Survival Analysis · Above-Average Departments (Derived Table) · EXISTS vs IN: Departments with Top Performers · Genres Without Blockbusters · Email Provider Customer Analysis · Management Hierarchy Overview · Departments With High Earners · Director Consistency Report · Simple Subquery: Above Average · Salary Percentile Ranking · Top Spender Per Country · Employees with Similar Salaries · Highest Fare Per Port · Correlated Subquery: Employees Above Department Median · Passenger Family Survival Analysis · Recursive Team Size Rollup · 3-Movie Rolling Average Revenue · Fare Percentile Ranking · Daily Active Customers · Engagement Streaks (3+ Orders, ≤7-Day Gaps) · Median Salary Without PERCENTILE · Anti-Join Pipeline: Unmatched Records · Customers with Orders in ALL Categories · Customer Lifetime Value Pipeline · Recursive Org Chart Traversal · Department Salary Percentile Buckets · Second Highest Salary per Department.
32 Google-tagged challenges with AI tutoring. No signup required. No credit card. Start writing SQL now.
Launch SQL Quest — It's FreeWorks on Chrome, Firefox, Safari, Edge · No plugins · No downloads
Interviewing at more than one company? The same patterns carry: Meta · Amazon · Apple · Netflix — or the full company-by-company interview guide.