SQL practice: LEFT JOIN: Keep Everything On The Left

Chapter 13 · 11 questions · included in full access

  1. Question 1 · easy

    Find branches that have never had an order.

    Solve it in your browser
  2. Question 2 · easy

    List every customer with their order count, including the ones with zero.

    Solve it in your browser
  3. Question 3 · medium

    List every branch with how many employees it has, including any with none.

    Solve it in your browser
  4. Question 4 · medium

    Find products that have never been sold.

    Solve it in your browser
  5. Question 5 · medium

    List every product with the total quantity sold, showing 0 for the unsold ones.

    Solve it in your browser
  6. Question 6 · medium

    List every branch with its total revenue, showing 0 where there is none.

    Solve it in your browser
  7. Question 7 · medium

    List every employee and the number of orders they handled, including those who handled none.

    Solve it in your browser
  8. Question 8 · medium

    Explain why COUNT(*) gives the wrong answer in 13-2, and what it would show instead.

    Solve it in your browser
  9. Question 9 · medium

    List every customer with their count of Delivered orders only, still including customers with none. (Careful where you put the condition.)

    Solve it in your browser
  10. Question 10 · hard

    A report counting customers uses COUNT(*) after a LEFT JOIN to orders, and says every customer has at least one order. Why?

    Solve it in your browser
  11. Question 11 · hard

    List every customer with how many Delivered orders they have. Customers with none should show 0, but they vanish. Fix it.

    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