Interview quiz track

First 2 free Junior SQL

SQL – GROUP BY and HAVING

Practice SQL GROUP BY and HAVING interview questions. Cover aggregating data, filtering groups, and common patterns. Write queries and receive feedback on correctness and approach. Ideal for beginner SQL interview prep. First 2 questions are free with full feedback.

  • Level Junior
  • Questions 12
  • GROUP BY
  • HAVING

Try any track free — first 2 questions include full AI feedback. Subscribe to finish the track and unlock everything. Type or speak your answer — the first 2 questions include scoring and detailed AI feedback.

Try first 2 questions free All tracks

Sample sql – group by and having interview questions

Preview 6 questions from this track in quiz order. In the full quiz you answer one at a time — type or speak — then get a score and feedback.

  1. What does GROUP BY do?

    What a strong answer includes

    Groups rows so aggregate functions can be applied.

  2. Write a query to count orders per customer.

    What a strong answer includes

    GROUP BY customer_id and COUNT.

  3. What is the difference between WHERE and HAVING?

    What a strong answer includes

    WHERE filters rows; HAVING filters groups.

  4. Write a query to find departments with more than 5 employees.

    What a strong answer includes

    GROUP BY and HAVING COUNT > 5.

  5. Can you use an aggregate function in a WHERE clause?

    What a strong answer includes

    No; use HAVING.

  6. Write a query to get total sales by product category.

    What a strong answer includes

    GROUP BY category and SUM.