106

I'm looking for beginner and intermediate level SQL puzzles, that I can point trainees at for practice.

I'm aware of http://sqlzoo.net/ which is a great resource - is there anything else out there that you could suggest?

0

9 Answers 9

60

Joe Celko's books and newsgroup posts are a good source of puzzles (with a variety of answers). They might be a bit more intermediate/advanced and not MySQL-specific, but are easy to follow and generally come from practical real-world situations.

Particularly, hunt down a copy of Joe Celko's SQL Puzzles and Answers (link to Google preview), it's a compilation of some of the best.

The SQLTeam forums occasionally have some interesting problems too, but generally focused on MS SQL Server.

The HackerRank SQL domain has a variety of SQL challenges that can be completed using multiple implementations (e.g.: Oracle, MySql, MS SQL Server, DB2).

0
22

There are lots of interesting puzzles and contests in BeyondRelational.Com

TSQL Challenges
TSQL Beginners Challenge

1
  • Are solutions posted anywhere for the beginners challenges?
    – Gabe
    Feb 21, 2011 at 0:38
17

SQL Server Central has some quizzes here:

http://www.sqlservercentral.com/tags/T-SQL/SQL+Puzzles/

There's also SQL Quiz, which is more like quiz questions rather than puzzles:

http://www.sqlquiz.com/

And Lessthandot has some general programmer puzzles:

http://forum.lessthandot.com/viewforum.php?f=102

11

One that I've used before is: http://www.sql-tutorial.ru/en

Has an interactive book with exercises (and tips) and solutions

0
10

You can sign up for SQLServerCentral's Newsletter and receive a Question of the Day (among other news and articles) in your mailbox daily.

One thing to note is that in addition to SQL, the questions also focus on database administration. They are pretty challenging though.

9

Practical skills of SQL language has a good collection of exercises for beginners as well as for experienced programmers.

5

The best puzzle site that I have found is Advanced SQL Problems which are well-written, thought provoking - the author thoughtfully provides DDL and data - unlike many questions here. Also, unlike many questions here, the desired result is also provided - well worth a look!

There are two sites which really stand out for learning SQL, especially Oracle (for MySQL see below).

  • Oracle forums. Pay particular attention to the posts of Frank Kulash and Solomon Yakobson (sometimes things of rare beauty) but anyone with a rep of > 20k merits attention. Check the rankings on the forums page.

  • Orafaq forums. Solomon Yakobson (again), Michel Cadot and Black Swan are to be followed here.

Many lesser padawan answer questions using PL/SQL only to be set straight by (amongst others) the sensei specified above who point out pure SQL solutions of such pulchritude as to make the Mona Lisa (La Gioconda) pale in comparison.

For MySQL see here - a "cookbook" of MySQL queries.

Finally, I would just say that there are many texts worthy of study. Check Celko, DuBois and Gulutzan inter alia.

Not about SQL puzzles per se, but more about grasping the Zeitgeist of SQL are two sites from Marcus Winand:

  • Modern SQL - describes the advances in SQL since the 1992 standard which (at least he feels) are under-utilised

  • Use The Index Luke - "A site explaining SQL indexing to developers—no crap about administration."

0
0

Answering my own question in order to suggest this entertaining SQL murder mystery puzzle - there's an "experienced" level, and a more detailed "walkthrough" level where each concept you'll need to solve the mystery is explained and practiced. Covers concepts from "What is SQL/a relational database" to aggregate functions and joins.

https://mystery.knightlab.com/

Github if you want to run locally: https://github.com/NUKnightLab/sql-mysteries

Not the answer you're looking for? Browse other questions tagged or ask your own question.