Your Cart
Loading

SQL Joins & GROUP BY Practice Pack

On Sale
$9.00
$9.00
Added to cart

A query that runs isn't the same as a query that's right. Most SQL mistakes don't produce an error. They produce a believable answer with a missing row, a count off by one, or two students merged into one. This pack trains you to catch those mistakes, using 25 problems solved the way an instructor grades them.


Every problem uses one small university database, campus.sql, included with the pack. Each problem has its own page, with a realistic request, tasks with point values, and space to work. Turn the page for the full solution: the answer query, the exact output, the steps, the mistake students make most often, and a 10-point rubric with typical deductions.


5 sections, easy to hard

  1. INNER JOIN (5 problems): three-table join paths, ambiguous columns, joining on the wrong key, and predicting row counts before you run a query.
  2. Outer joins and NULLs (6 problems): LEFT and FULL OUTER JOIN, the WHERE clause that quietly breaks a LEFT JOIN, COUNT(*) versus COUNT(column), COALESCE, and the NOT IN trap.
  3. GROUP BY and aggregates (6 problems): grouping by the right key, SUM and AVG with NULLs, two-level grouping, distinct counts, and the join that inflates your SUM.
  4. HAVING and query logic (4 problems): WHERE versus HAVING, logical query order, comparing groups to their own average, and ranking with window functions.
  5. Self-joins and find the mistake (4 problems): mentors and classmates, a query with five planted errors, and a student submission to grade with an instructor rubric.


What makes it different

  • Written by a college database instructor, around the mistakes that show up again and again in real student work.
  • Every answer is tested. Each query and expected output was run against campus.sql in SQLite and PostgreSQL 18. Where the two databases behave differently, the solution tells you.
  • Rubrics, not just answers. You'll see where the points go, so you can tell a mostly right query from an exam-ready one.
  • Edge cases built in. The dataset is small enough to check by hand, and it's full of the cases that break careless queries.
  • Built to retake. The score tracker at the back totals your score out of 250 and flags anything under 7 to redo a week later.


Difficulty mix: 6 easy, 12 medium, 7 hard. Suggested times range from 5 to 20 minutes per problem.


Good for: students in an intro or intermediate database or SQL course, anyone preparing for a midterm, final or technical interview, and analysts who write reporting queries and want to trust their numbers.


Not for: database design, query tuning, indexing or stored procedures. This pack is about writing correct SELECT queries. For design, see the Normalization & ERD Practice Pack: [link to Normalization & ERD pack]


Files: PDF, 95 pages, US Letter, plus campus.sql. Prints cleanly and works on a tablet or laptop. Your copy is stamped for personal use.


Try before you buy: 5 of the 25 problems are free here: https://payhip.com/b/5PWEv


Tags / keywords

SQL, SQL joins, GROUP BY, HAVING, LEFT JOIN, FULL OUTER JOIN, window functions, SQL practice problems, SQLite, PostgreSQL, SQL exam prep, SQL interview prep, database course study guide

You will get the following files:
  • PDF (324KB)
  • SQL (4KB)