Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Are there any websites for SQL puzzle games?
157 points by novoreorx 4 months ago | hide | past | favorite | 46 comments
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!




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


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.


Going through Hannukah of Data was so fun! Thanks!


Thanks for that!

I really enjoyed doing it when it was released!

Looking forward to the next one


If you subscribe to the newletter here: https://hanukkah.bluebird.sh/about/ =) You'll here about our next datagame.


I often use https://pgexercises.com/ to refresh my knowledge


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.


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


You don't even need Malloy if you use DuckDB, just a .parquet file or .csv file. https://duckdb.org/docs/data/overview


There's also nothing stopping you from running postgres, sql server, MySQL etc locally.


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.


Can you recommend any good book/resource to pick up PostgreSQL?

I'm familiar with MySQL/MariaDB, but have no experience with Postgres.


The best I've seen is The Art of PostgreSQL: https://theartofpostgresql.com/


Thank you, sir!


I always google what I need. I admit I haven’t gone deep into it. Just the basics for side projects.


I’ve had fun going through SQL Murder Mystery (https://mystery.knightlab.com/)

I even use it for hiring exercises.


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%'`


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.


The connection times out to the website. Any links of same exercises and book available more generally?


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.


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


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.


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?


I don't have my Gitlab credentials set up on my Laptop but I'll open an issue in the Gitlab Repo once I'm finished with my exams.


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/


Not a game but a great way to learn SQL is https://sqlbolt.com


+1 I like this one a lot.


A few of them exist. I played a bit on the SQL section of HackerRank in the past: https://www.hackerrank.com/domains/sql


That is an excellent source. I'll explore it a bit.



There used to be a multiplayer space game called Schemaverse that was played by writing sql, but it seems to have gone away.

https://schemaverse.com/



https://detective.kusto.io/

It's not SQL directly (it's the Kusto query language) which is more geared towards reading data and analytics.

I'm suggesting it however because the queries in it are also basically relational algebra (aka much of the knowledge is transferable to SQL - minus some special features like anomaly analysis), they give decently sized datasets with billions of rows and the challenges themselves were fun.


Select Star SQL is pretty interesting, but short - https://selectstarsql.com/beazley.html


This SQL murder mystery is fun and helpful! https://mystery.knightlab.com/


Thanks everyone who have commented all these sites. I wanted to brush up SQL for interviews and these will help a lot.


At beginner level, there is SQL Island https://sql-island.informatik.uni-kl.de, with versions in German, English and French.


Where is the English language version? Would love to use with my son!


Click on menu symbol, then on "Sprache wechseln", then English


Just open the Hamburger menu and then click „Sprache wechseln“.



Codesignal has a fun Database “Arcade” https://app.codesignal.com/arcade/db


Thanks for asking. Had a similar issue--no avenue to practice queries intentionally, outside of solving a real-world problem with all the confounding factors that entails.

Nice options ITT.



A coworker used to solve Project Euler[1] problems using SQL while they waited for DB indexes to rebuild or tables to restore from backup in the middle of the night.

[1] https://projecteuler.net/


UPDATE POSTS SET VOTE_COUNT = VOTE_COUNT + 1 WHERE POST_ID = CURRENT_POST_ID();

CREATE TABLE SQL_GAMES blah blah blah

INSERT INTO SQL_GAMES many invited users blah blah blah

SELECT * FROM SQL_GAMES WHERE users are having fun blah blah blah

PROFIT blah blah blah

ENJOY even more blah

-- TODO: drastically restructure above schema and SQL statements to make more sense blah blah blah

-- there's your game blah blah blah




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: