SQL
115 practice items · needed by 8 roles
Easy 51Medium 37Hard 27
Practice questions
- Stopping SQL injectioneasy
- Purpose of a database indexeasy
- Rows returned by a LEFT JOINeasy
- What a foreign key enforceseasy
- Atomicity in a money transfereasy
- COUNT and AVG with NULLseasy
- Filtering grouped resultseasy
- Duplicate emails despite a checkeasy
- What EXPLAIN tells youeasy
- Database user for the appeasy
- The N+1 query problemmedium
- Isolation levels and dirty readsmedium
- Offset or cursor paginationmedium
- Composite index column ordermedium
- Optimistic lock update hits 0 rowsmedium
- Index ignored for lower(email)medium
- Lost update on a wallet balancehard
- NOT IN with a NULL in the listhard
- Sorting by a user-chosen columnhard
- Preventing SQL injectioneasy
- Listing users with zero orderseasy
- Comparing a column to NULLeasy
- What an index costseasy
- Moving credits between accountsmedium
- Composite index column ordermedium
- Two agents edit one tickethard
- Items missing between pageshard
- NOT IN returns no rowshard
- Purpose of a primary keyeasy
- INNER JOIN vs LEFT JOINeasy
- DELETE vs TRUNCATEeasy
- Filtering rows where a value is NULLeasy
- COUNT(*) vs COUNT(column)easy
- What a foreign key enforceseasy
- WHERE vs HAVINGeasy
- View vs materialized vieweasy
- UNION vs UNION ALLeasy
- Row order without ORDER BYeasy
- Rejecting bad valueseasy
- NOT IN returns nothingmedium
- Counting orders per customereasy
- Customers with no orderseasy
- Filtering groups in SQLeasy
- COUNT of a column with NULLseasy
- Latest order per customermedium
- Ranking with ties in SQLmedium
- NOT IN returns no rowsmedium
- LEFT JOIN that acts like INNER JOINhard
- 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
- 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
- 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
- Purpose of a primary keyeasy
- Row count of a LEFT JOINeasy
- Filtering with = NULLeasy
- COUNT(*) vs COUNT(column)easy
- Filtering groups with HAVINGeasy
- Adding a number to NULLeasy
- Upserting into a target tablemedium
- Keeping the latest row per keymedium
- RANK and DENSE_RANK with tiesmedium
- NOT IN with a NULL in the listmedium
- Day-over-day change with LAGmedium
- WHERE filter after a LEFT JOINmedium
- Counting orders for every customermedium
- Table state after a MERGEmedium
- Revenue doubled after a joinmedium
- Employees above their team averagemedium
- Running total with tied dateshard
- LAST_VALUE returns the current rowhard
- Longest login streakhard
- FULL OUTER JOIN row counthard
- GROUP BY with NULL keyshard
- Recursive CTE stopping pointhard
- Double counting in an SCD2 joinhard
- Distinct users on billions of rowshard
- Verifying data with SQLmedium
- Finding duplicate records with SQLmedium
- Migration check returns nothinghard
- Filtering rows in SQLeasy
- Finding customers with no ordersmedium
- Customers with many ordersmedium