Data Analyst
SQL questions
37 questions on SQL for data analysts, easiest first.
Easy 15
- WHERE vs HAVINGeasy
- Which join keeps all customerseasy
- COUNT(*) vs COUNT(column)easy
- Finding NULL valueseasy
- COUNT(DISTINCT) with NULLseasy
- Rows from an INNER JOINeasy
- UNION vs UNION ALLeasy
- AVG with a NULL valueeasy
- Bucketing with CASE WHENeasy
- Dividing two integers in SQLeasy
- Why this GROUP BY failseasy
- Does BETWEEN include the endseasy
- Matching text with LIKEeasy
- Top seller with ORDER BY and LIMITeasy
- What a primary key guaranteeseasy
Medium 11
- Revenue doubled after a joinmedium
- Latest order per customermedium
- Running total of salesmedium
- LEFT JOIN that lost customersmedium
- RANK vs DENSE_RANK after a tiemedium
- Month-over-month change with LAGmedium
- Share of paid orders in one querymedium
- Customers who never orderedmedium
- Grouping orders by monthmedium
- Counting repeat customers with a CTEmedium
- SUM over zero matching rowsmedium
Hard 11
- NOT IN returns nothinghard
- Daily numbers do not matchhard
- Running total with tied dateshard
- Filter inside the ON clausehard
- Not-equal filter loses rowshard
- PERCENTILE_CONT vs PERCENTILE_DISChard
- NTILE with 10 rowshard
- Latest order changes between runshard
- Click-through rate with zero impressionshard
- Adding up daily active usershard
- GROUP BY with NULL citieshard