SQL practice: Errors You Will Definitely Hit

Chapter 33 · 6 questions · included in full access

  1. Question 1 · easy

    This query fails because order_date is neither grouped nor aggregated. Fix it so order_date is aggregated with MAX() as latest_order.

    Solve it in your browser
  2. Question 2 · easy

    This query fails because WHERE runs before SELECT, so the alias 'limit' doesn't exist yet. Fix the WHERE clause to use the actual column name.

    Solve it in your browser
  3. Question 3 · medium

    This query fails because the subquery returns multiple customer IDs for Mumbai, but = expects exactly one value. Fix it using IN.

    Solve it in your browser
  4. Question 4 · medium

    This query accidentally produces a massive Cartesian product because there is no join condition. Fix it with a proper INNER JOIN on customer_id.

    Solve it in your browser
  5. Question 5 · hard

    This query fails with 'column emial does not exist'. Fix the spelling of email.

    Solve it in your browser
  6. Question 6 · hard

    This query fails because customer_id exists in both tables, making the column reference ambiguous. Qualify customer_id with orders.

    Solve it in your browser

These questions are part of full access.

The first chapters of every track are free. Full access is a one-time payment.

See pricing