SQL practice: UNION: Stacking Results

Chapter 15 · 7 questions · included in full access

  1. Question 1 · easy

    Make one list of all cities in customers and branches, without duplicates.

    Solve it in your browser
  2. Question 2 · easy

    Find cities that appear in both customers and branches.

    Solve it in your browser
  3. Question 3 · medium

    Find cities that have a customer but no branch.

    Solve it in your browser
  4. Question 4 · medium

    Find cities that have a branch but no customer.

    Solve it in your browser
  5. Question 5 · medium

    Make a combined list of all names — every customer_name and every employee_name — with a second column saying which kind each one is.

    Solve it in your browser
  6. Question 6 · hard

    Explain why 15-1 with UNION ALL gives more rows than with UNION.

    Solve it in your browser
  7. Question 7 · hard

    Build one list of every city that has a customer or a branch, each city once. The query errors. 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