SQL practice: Joining Three or More Tables

Chapter 14 · 10 questions · included in full access

  1. Question 1 · easy

    Show order_id, customer_name and branch_name for every order. (Two lookups from orders.)

    Solve it in your browser
  2. Question 2 · easy

    Add employee_name to 14-1, so you have all four in one row.

    Solve it in your browser
  3. Question 3 · medium

    Show every order line with the customer name, product name, and line total (quantity × unit_price).

    Solve it in your browser
  4. Question 4 · medium

    Do 14-3 again, but only for Delivered orders.

    Solve it in your browser
  5. Question 5 · medium

    Show every stock transfer with the product name and the from branch name.

    Solve it in your browser
  6. Question 6 · medium

    Show the total revenue per branch region — you'll need to travel order_items → orders → branches.

    Solve it in your browser
  7. Question 7 · medium

    Count the orders per customer, showing the customer's name and city. Should you use COUNT(*) or COUNT(DISTINCT ...)? Justify it.

    Solve it in your browser
  8. Question 8 · medium

    How many rows does orders joined to order_items return, and why isn't it 41?

    Solve it in your browser
  9. Question 9 · hard

    Trace the path on the map: which tables must you join to get from products to branches?

    Solve it in your browser
  10. Question 10 · hard

    For each branch, show how many orders it took and the total quantity sold. The orders number is too high. 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