AI guide
【One-Line Pitch】
A hands-on SQL workbook that builds real querying skill through 57 progressively harder problems on a realistic sample database, rather than through syntax lectures. Best for people who already know basic SQL keywords and want the problem-solving reps that job interviews and data work actually demand.
【Book Arc】
- **Opening (~0%–8%)**: Sets up the learn-by-doing philosophy, explains what the book deliberately omits (exhaustive syntax, cross-vendor comparisons, INSERT/UPDATE/DELETE), and walks you through installing MS SQL Server Express and the sample database.
- **Early (~8%–31%)**: Warm-up problems on single-table filtering, sorting, and formatting—WHERE clauses, IN vs. multiple ORs, CONVERT for dates, and basic aggregation like counting products per category.
- **Early–Middle (~31%–46%)**: Introduces joins and grouping: LEFT JOIN to find customers with no orders, self-joins, derived tables, and CTEs, plus the classic "accidental double-entry" debugging exercise where you fix buggy SQL.
- **Middle (~46%–62%)**: Moves into business-flavored analysis—late orders per employee, fixing NULLs, integer-division pitfalls, high-value customer identification, and flexible customer grouping via a threshold table.
- **Late (~62%–85%)**: Advanced multi-step problems: countries with suppliers or customers, self-joins with meaningful aliases, date-difference calculations between consecutive orders, and comparing alternative solutions (LEFT JOIN/IS NULL vs. NOT IN vs. NOT EXISTS).
- **Ending (~85%+)**: The remaining problems and answer discussions reinforce good programming practice, readability, and choosing among equivalent approaches—the excerpts do not cover the final problems in detail.
【Key Takeaways】
- **The book teaches SQL by problem-solving, not by syntax reference** (Opening): it assumes you can look up keywords and instead trains you to analyze a data question and work toward a query. (Opening)
- **Filtering fundamentals get real-world treatment** (Early): WHERE with IN, <>, and multi-value lists, plus formatting dates with CONVERT—small skills that recur constantly. (Early)
- **Joins are the hinge of the whole book** (Early–Middle): LEFT JOIN to find non-matching rows, self-joins for comparisons, and derived tables/CTEs for multi-step logic. (Early–Middle)
- **Debugging broken SQL is treated as a core skill** (Middle): the double-entry problem gives you buggy SQL returning 20 rows instead of 16 and asks you to find why. (Middle)
- **Aggregation plus business logic is where intermediate skill lives** (Middle): late-order counts per salesperson, NULL-to-zero fixes, and integer-division traps that silently corrupt percentages. (Middle)
- **Flexible, data-driven grouping beats hard-coded thresholds** (Middle): using a CustomerGroupThreshold table so boundaries can change without editing SQL. (Middle)
- **Multiple correct solutions exist, and the book discusses trade-offs** (Late): LEFT JOIN/IS NULL, NOT IN, and NOT EXISTS are compared, with readability and performance noted. (Late)
- **Readable SQL is an explicit goal** (Late): meaningful table aliases, one filter value per line, and clear naming are presented as professional practice. (Late)
【Reading Tips】
- **Do the problems before reading the answers.** The hints are tiered for harder questions—use the first hint, try again, and only then read the discussion. Passive reading defeats the book's purpose.
- **Deep-read the discussion sections even when your query works.** They contain alternative approaches and pitfalls (integer division, NULL handling, discount math) that are the real transferable lessons.
- **Skim the setup chapter if you already have a SQL environment**, but do load the sample database—every problem depends on its schema and expected results.
- **Treat the middle section as the hard wall.** Joins, CTEs, and derived tables are where most learners stall; slow down there rather than rushing to the advanced problems.
- **Keep a personal snippet file** of patterns you got wrong (NOT EXISTS, self-join aliases, date functions) and revisit them before interviews.
【Coverage Limits】
This guide is based on stratified excerpts covering the book's framing, setup, and a sampling of problems from early through late sections; the excerpts do not cover every one of the 57 problems or the full answer discussions, so specific later problems may differ from the patterns described here.
Passage locations
Excerpt 1
iptions of syntax. There’s just what you need, and no more. A discussion of differences between every single SQL variant (MS SQL Server, Oracle, MySQL). That...
View in text
Excerpt 2
00 2 30.00 11077 75 7.75 4 31.00 11077 77 13.00 2 26.00 ...
View in text
Excerpt 3
re. We only want to consider orders made in the year 2016. Unknown Expected Result CustomerID CompanyName TotalOrderAmount -----...
View in text
Excerpt 4
m WHITC White Clover Markets 15278.90 Very High WILMK Wilman Kala 1987.00 ...
View in text