
SQL puzzles & answers
by Joe Celko · first published 1997
4mentions
3recommended by
4HN commenters
2009–2023first – last mentioned
75% recommend25% neutral
"In this complete revision and expansion of his first SQL Puzzles book, Joe Celko challenges you with his trickiest puzzles - and then helps solve them with a variety of solutions and explanations. Joe demonstrates the thought processes that are involved in attacking a problem from an SQL perspective to help advanced database programmers solve the puzzles you frequently face. These techniques not only help with the puzzle at hand, but help develop the mindset needed to solve the many difficult SQL puzzles you face every day. Of course, part of the fun is to see whether or not you can write bet
Affiliate links. As an Amazon Associate I earn from qualifying purchases.


Joe Celko's "SQL For Smarties" and "SQL Puzzles and Answers" are classics in the field. They're still very relevant despite being 10+ years old, since SQL hasn't changed anywhere near as much as, say, Java in that time. http://www.celko.com/books.htm
on “Ask HN: Best Book for learning SQL?” ↗Honestly, you picked the right one. It's restricted, so what you learn will be widely applicable. Do yourself a favor and pick up some books about SQL by Joe Celko's SQL Puzzles and Answers. If you follow it, you will learn how to accomplish various queries while having restrictions on dialects or whatever. It's a real mind-expander. I found myself doing in SQLite things I hadn't thought…
on “SQL Reserved Words – The Empirical List” ↗Take a look at Joe Celko's SQL Puzzles and Answers.
on “Why 37signals Doesn't Hire Programmers Based on Brainteasers” ↗Celko's SQL Puzzles and Answers: http://www.amazon.com/Puzzles-Answers-Kaufmann-Management-eb...
on “Is there a K&R for SQL?” ↗