Interview quiz track

First 2 free Intermediate SQL

SQL – Subqueries and CTEs

Practice SQL subqueries and Common Table Expressions (CTEs) commonly asked in interviews. Cover correlated subqueries, nested queries, and readable CTE patterns. Write queries and receive feedback on correctness and approach. Ideal for intermediate SQL interview prep. First 2 questions are free with full feedback.

  • Level Intermediate
  • Questions 12
  • SQL
  • subqueries
  • CTEs
  • intermediate
  • interview practice

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 – subqueries and ctes 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 is a subquery and when would you use one?

    What a strong answer includes

    Query inside another query for filtering or calculation.

  2. Write a query to find employees who earn more than the average salary.

    What a strong answer includes

    Uses a subquery in the WHERE clause.

  3. What is a CTE and why use it instead of a subquery?

    What a strong answer includes

    Improves readability and can be reused.

  4. Write a query using a CTE to calculate total sales by region, then filter regions above a threshold.

    What a strong answer includes

    Clear WITH clause and final SELECT.

  5. Explain a correlated subquery.

    What a strong answer includes

    References the outer query and runs per row.

  6. Write a query to find customers who have placed more orders than the average customer.

    What a strong answer includes

    Uses a subquery or CTE for the average.