SQL for Analytics interview questions
100 Data Analyst practice questions. Read what a strong answer covers, then practise it out loud against the clock.
Practise SQL for Analytics questionsBeginner
- Average order value looks too high
- CASE WHEN expressions
- Choosing the right COUNT
- Common string functions
- Common table expressions
- Conversion rate shows as zero
- Customers who have never ordered
- Daily numbers don't match the dashboard
- Data types and casting
- Each customer's most recent order
- How GROUP BY works in reports
- How NULL behaves in SQL
- IN vs EXISTS
- Monthly revenue report
- ORDER BY and LIMIT for top-N
- Order of a SQL query's execution
- Orders by status in one row per day
- Orders missing from the last day of the month
- Pattern matching with LIKE
- Primary and foreign keys for analysts
- Products sold more than 100 times last month
- Revenue doubled after adding a join
- ROW_NUMBER, RANK and DENSE_RANK
- Same city counted several times
- Self joins
- SQL join types for analysts
- Stacking results with UNION vs UNION ALL
- Subqueries
- Top 3 products in each category
- Using DISTINCT
- Views and when analysts use them
- WHERE vs HAVING in analytical queries
- Window functions for analysts
- Working with dates in SQL
Intermediate
- A dashboard query takes 10 minutes
- Approximate distinct counts
- Building a cohort retention table in SQL
- Calculating DAU, WAU and MAU
- Comparing rows with LAG and LEAD
- Each product's share of category revenue
- End-of-month balances from transaction data
- Fact and dimension tables
- Filling gaps with a date spine
- Finance and marketing revenue don't match
- Finding the longest login streak
- First-touch marketing channel for each customer
- Funnel analysis in SQL
- Grouping events into sessions
- Measuring time spent in each order status
- Median delivery time by city
- Month-over-month growth by region
- NULLs in sorting, grouping and aggregates
- Pivoting and unpivoting data in SQL
- Querying JSON data in SQL
- Reading a query plan as an analyst
- Removing duplicate rows from an events table
- Repeat purchase rate within 30 days
- Rolling 7-day unique buyers
- ROLLUP, CUBE and GROUPING SETS
- Rows disappear after joining on a nullable column
- Running totals and moving averages
- Segmenting customers into spending tiers
- Semi-joins and anti-joins
- Slowly changing dimensions
- SQL differences across warehouses
- Writing efficient analytical queries
- Year-over-year comparison by week
Experienced
- Active subscribers per day from start and end dates
- Analytics engineering with dbt
- Average price fell, but every product's price rose
- Computing A/B test results in SQL
- Controlling warehouse query costs
- Cumulative revenue per customer cohort
- Data skew in distributed queries
- Diagnosing a revenue drop with SQL
- Double counting with many-to-many relationships
- Estimating lost sales from stockouts
- Flagging unusual daily metrics with SQL
- Incremental models for analytics
- Linear multi-touch attribution in SQL
- Measuring the effect of a price change with SQL data
- Monthly churn rate for a subscription business
- Pattern matching across rows
- Recursive CTEs for hierarchies
- Reporting revenue across currencies
- Reproducible analysis queries
- Reviewing a colleague's SQL before a board report
- Sales by sales rep territory at the time of sale
- Sampling large datasets in SQL
- Semantic layers and metric definitions
- Strict ordered funnel with time limits
- Supply and demand balance in a marketplace
- Testing analytical SQL
- Time to first value for new users
- Time zones in global analytics
- Untangling a 1,000-line legacy query
- Upstream schema change silently breaks reports
- Window frame clauses in depth
- Window function query runs out of memory
- Yesterday's numbers keep changing