6 ms·
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!
- speedgoose 3y agoA few of them exist. I played a bit on the SQL section of HackerRank in the past: https://www.hackerrank.com/domains/sql https://www.hackerrank.com/domains/sql
- novoreorx 3y agoThat is an excellent source. I'll explore it a bit.
- Leftium 3y agoSQL Police Department – Learn SQL while solving crimes: - https://hw.leftium.com/#/item/23066776 https://hw.leftium.com/#/item/23066776 Lost at SQL: The SQL learning game: - https://hw.leftium.com/#/item/35665142 https://hw.leftium.com/#/item/35665142 There are even more games in the comments.
- shouldnt_be 3y agoI often use https://pgexercises.com/ https://pgexercises.com/ to refresh my knowledge
- PascLeRasc 3y agoSelect Star SQL is pretty interesting, but short - https://selectstarsql.com/beazley.html https://selectstarsql.com/beazley.html
- arono 3y agoI’ve had fun going through SQL Murder Mystery (https://mystery.knightlab.com/ https://mystery.knightlab.com/) I even use it for hiring exercises.
- fbdab103 3y agoWhile 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%'`
- jiehong 3y agoMaybe 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/ https://leetcode.com/problem-list/leetcode-curated-sql-70/ [1]: https://hanukkah.bluebird.sh https://hanukkah.bluebird.sh
- saulpw 3y agoCreator 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.
- anjakefala 3y agoIf you subscribe to the newletter here: https://hanukkah.bluebird.sh/about/ https://hanukkah.bluebird.sh/about/ =) You'll here about our next datagame.
- gabrielsroka 3y agoMight be somewhat helpful https://www.khanacademy.org/computing/computer-programming/sql https://www.khanacademy.org/computing/computer-programming/s...
- yurpree43 3y agoCodesignal has a fun Database “Arcade” https://app.codesignal.com/arcade/db https://app.codesignal.com/arcade/db
- uncharted9 3y agoThanks everyone who have commented all these sites. I wanted to brush up SQL for interviews and these will help a lot.
- Cheezmeister 3y agoThanks 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.
- roland35 3y agoThis SQL murder mystery is fun and helpful! https://mystery.knightlab.com/ https://mystery.knightlab.com/
- geshan 3y agoNot a game but a great way to learn SQL is https://sqlbolt.com https://sqlbolt.com
- joshestroud 3y ago+1 I like this one a lot.
- jasonpeacock 3y agoA 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/ https://projecteuler.net/
- evilotto 3y agoThere 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://schemaverse.com/
- calgoo 3y agoFound this on GitHub: https://github.com/Abstrct/Schemaverse https://github.com/Abstrct/Schemaverse
- newprint 3y agowww.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 3y agoThe connection times out to the website. Any links of same exercises and book available more generally?
- fuzztester 3y agoUPDATE 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
- deleted 3y ago[deleted]
- NortySpock 3y agoOthers 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 3y agoYou 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 https://docs.malloydata.dev/documentation/patterns/yoy
- prometheon1 3y agoYou don't even need Malloy if you use DuckDB, just a .parquet file or .csv file. https://duckdb.org/docs/data/overview https://duckdb.org/docs/data/overview
- sfn42 3y agoThere's also nothing stopping you from running postgres, sql server, MySQL etc locally.
- quickthrower2 3y agoPostgres 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.
- cronopios 3y agoCan you recommend any good book/resource to pick up PostgreSQL? I'm familiar with MySQL/MariaDB, but have no experience with Postgres.
- laowantong 3y agoAt beginner level, there is SQL Island https://sql-island.informatik.uni-kl.de https://sql-island.informatik.uni-kl.de, with versions in German, English and French.
- BazookaMusic 3y agohttps://detective.kusto.io/ 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.
- azraellzanella 3y agohttps://www.sqlzoo.net/wiki/SQL_Tutorial https://www.sqlzoo.net/wiki/SQL_Tutorial
- leifhka 3y agoNot 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 https://gitlab.com/leifhka/datastar
- awesomeMilou 3y agoI'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 3y agoFeedback 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?
- awesomeMilou 3y agoI 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.
- liamN 3y agoMaybe 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/ https://lost-at-sql.therobinlord.com/
- clatterrr 3y ago[dead]
- horsellama 3y agohttps://code.golf/rankings/holes/all/sql/bytes https://code.golf/rankings/holes/all/sql/bytes