Readit News logoReadit News
Posted by u/novoreorx 2 years ago
Ask HN: Are there any websites for SQL puzzle games?
As a Python programmer, I often use Django or SQLAlchemy ORM and as a consequence, my proficiency in raw SQL remains at a basic level. However, I am keen on improving my raw SQL skills, given it's sometimes superior to ORM, and because I find SQL and relational algebra surprisingly fun to think about.

Does anyone know of websites that provide SQL puzzle games that allow users to solve problems by writing SQL and validating them? I believe this would be an engaging way to enhance my SQL skills. Your suggestions are appreciated!

jiehong · 2 years ago
Maybe less fun than others, but actually not so bad: leetcode [0]

Otherwise, in the same vein as the SQL murder mystery, you can try the Hanukkah of Data [1].

[0]: https://leetcode.com/problem-list/leetcode-curated-sql-70/

[1]: https://hanukkah.bluebird.sh

saulpw · 2 years ago
Creator of Hanukkah of Data here! We're working on another data puzzle game that we'll be announcing shortly, to be released in a couple of months. I think games like this are a great way to exercise SQL and other data skills.
SJMosley · 2 years ago
Going through Hannukah of Data was so fun! Thanks!
jiehong · 2 years ago
Thanks for that!

I really enjoyed doing it when it was released!

Looking forward to the next one

anjakefala · 2 years ago
If you subscribe to the newletter here: https://hanukkah.bluebird.sh/about/ =) You'll here about our next datagame.
shouldnt_be · 2 years ago
I often use https://pgexercises.com/ to refresh my knowledge
NortySpock · 2 years ago
Others have given you excellent suggestions; I will simply offer an addition -- a side quest, if you will:

Remember that the local single-user databases SQLite and DuckDB exist, and that you can use them to wrangle data without even having to set up a separate server. You just create a database file on your machine and go from there.

mrtimo · 2 years ago
You don't even need a database file if you use Malloy, just a .parquet file or .csv file will work. Think of a .parquet file as a python dataframe saved as a file. DuckDB combined with Malloy are a powerful combo. If you like writing SQL queries for fun, you should like writing Malloy queries even more (at least I do). If you are looking to compare timeframes, Malloy does this well: https://docs.malloydata.dev/documentation/patterns/yoy
prometheon1 · 2 years ago
You don't even need Malloy if you use DuckDB, just a .parquet file or .csv file. https://duckdb.org/docs/data/overview
sfn42 · 2 years ago
There's also nothing stopping you from running postgres, sql server, MySQL etc locally.
quickthrower2 · 2 years ago
Postgres running local has good ROI. You can reuse that knowledge on a remote server. More than SQL you can learn about setting up databases and schemas etc.
arono · 2 years ago
I’ve had fun going through SQL Murder Mystery (https://mystery.knightlab.com/)

I even use it for hiring exercises.

fbdab103 · 2 years ago
While it was not challenging SQL, it does require paying attention to the prompt, writing the queries, and following the clues. I could easily see myself blowing it in an interviewing situation with someone staring me down. In the zero pressure environment at home, I almost tripped on the fact that the license plate clue said it "included XYZ" while I initially queried `like 'XYZ%'`
newprint · 2 years ago
www.sql-ex.ru + the book on that site are by far the best SQL exercises I have seen. PS. I know you asking about just RAW SQL, but I highly suggest you get into understanding how particular DBMS works in depth, what plans it builds, what concurrency mechanisms it uses. Writing raw SQL will get you only so far, making those queries actually production ready is completely different ballgame and for that, you don't need to be super proficient in SQL.
wanderingmind · 2 years ago
The connection times out to the website. Any links of same exercises and book available more generally?
Leftium · 2 years ago
SQL Police Department – Learn SQL while solving crimes:

- https://hw.leftium.com/#/item/23066776

Lost at SQL: The SQL learning game:

- https://hw.leftium.com/#/item/35665142

There are even more games in the comments.

leifhka · 2 years ago
Not quite puzzles, but since someone else mentioned Schemaverse, I have made a similar but Elite inspired SQL-game called Datastar [1]. It features a simulated economy with traders and miners, and the goal is to make as much money as possible. Everything is done via SQL (or other PostgreSQL features), and the player need to make and manage a database of information about the planets and their economies.

I teach uni. couses on databases and made the game for my student to give them a more self-driven way to learn SQL.

[1] https://gitlab.com/leifhka/datastar

awesomeMilou · 2 years ago
I'm trying this out right now, since I'm writing a database exam on thursday. Is there a way to provide feedback?

I feel like the game has a lot of potential but some stuff feels kinda painful.

Like figuring out all constants for example.

leifhka · 2 years ago
Feedback would be great, thank you! For concrete pains I welcome making issues on the repo. Otherwise you could comment here or DM me :) Also note that the game is far from finished, with lots of remainong TODOs.

Regarding constants, which are you thinking of?

liamN · 2 years ago
Maybe this is more begginner than youre looking for, but I saw this one ("Lost at SQL") here on HN last year. https://lost-at-sql.therobinlord.com/