Skip to content

Files

Latest commit

6b894e5 · Nov 14, 2024

History

History

Advanced SQL Puzzles

Advanced SQL Puzzles

This directory contains my collection of SQL puzzles. I hope you enjoy these puzzles as much as I have enjoyed creating them!

To get started, download the Advanced SQL Puzzles.pdf.

⌨️      The solutions provided are written in Microsoft SQL Server T-SQL, but you can easily modify them to fit your flavor of SQL.

❓      If you have any questions, please feel free to create a GitHub discussion. I am always happy to help out and explain different solutions.

About

As my list of puzzles continues to grow, I have decided to combine the puzzles into one single PDF document broken down into two different sections.

  • In the first section, I have 64 of the most difficult puzzles I could create, randomly organized and in no specific order. These are primarily set-based puzzles, interspersed with a small number of puzzles that require knowledge of constraints, specific data types, cursors, loops, etc...

  • In the second set of puzzles, I have collected all the puzzles related to permutations, combinations, and sequences. Solving these puzzles will require a deeper knowledge of your SQL thinking, focusing on such constructs as using recursion or sequence objects to reach the desired output.

Getting Started

To get started, download the Advanced SQL Puzzles.pdf.

  • Solutions are provided in the Advanced SQL Puzzles Solutions.sql script
  • If you want the CREATE TABLE and INSERT statements without the solutions, see the script Advanced SQL Puzzles DDL.sql.
  • Solutions for the second set of puzzles are located in the directory Part II.
  • I also keep my collection of SQL statements using recursion in the directory Recursion Examples. Here you can find out how to solve Markov chains, solve the Traveling Salesman problem, calculate floor and ceiling caps, or find a solution to a Sudoku puzzle.

📫      If you find any inaccuracies, misspellings, bugs, dead links, etc... please report an issue! No detail is too small, and I appreciate all the help.

😄      Happy coding!

I hope you find this repository to be useful and informative, and I welcome any new puzzles or tips and tricks you may have. I also have a WordPress site where you can find my data analytics projects, Python puzzles, and blog.

https://advancedsqlpuzzles.com