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.<p>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]<p>Otherwise, in the same vein as the SQL murder mystery, you can try the Hanukkah of Data [1].<p>[0]: <a href="https://leetcode.com/problem-list/leetcode-curated-sql-70/" rel="nofollow">https://leetcode.com/problem-list/leetcode-curated-sql-70/</a><p>[1]: <a href="https://hanukkah.bluebird.sh" rel="nofollow">https://hanukkah.bluebird.sh</a>
Others have given you excellent suggestions; I will simply offer an addition -- a side quest, if you will:<p>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.
I’ve had fun going through SQL Murder Mystery (<a href="https://mystery.knightlab.com/" rel="nofollow">https://mystery.knightlab.com/</a>)<p>I even use it for hiring exercises.
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.
SQL Police Department – Learn SQL while solving crimes:<p>- <a href="https://hw.leftium.com/#/item/23066776" rel="nofollow">https://hw.leftium.com/#/item/23066776</a><p>Lost at SQL: The SQL learning game:<p>- <a href="https://hw.leftium.com/#/item/35665142" rel="nofollow">https://hw.leftium.com/#/item/35665142</a><p>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.<p>I teach uni. couses on databases and made the game for my student to give them a more self-driven way to learn SQL.<p>[1] <a href="https://gitlab.com/leifhka/datastar" rel="nofollow">https://gitlab.com/leifhka/datastar</a>
Maybe this is more begginner than youre looking for, but I saw this one ("Lost at SQL") here on HN last year.
<a href="https://lost-at-sql.therobinlord.com/" rel="nofollow">https://lost-at-sql.therobinlord.com/</a>
A few of them exist. I played a bit on the SQL section of HackerRank in the past: <a href="https://www.hackerrank.com/domains/sql" rel="nofollow">https://www.hackerrank.com/domains/sql</a>
There used to be a multiplayer space game called Schemaverse that was played by writing sql, but it seems to have gone away.<p><a href="https://schemaverse.com/" rel="nofollow">https://schemaverse.com/</a>
<a href="https://detective.kusto.io/" rel="nofollow">https://detective.kusto.io/</a><p>It's not SQL directly (it's the Kusto query language) which is more geared towards reading data and analytics.<p>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 - <a href="https://selectstarsql.com/beazley.html" rel="nofollow">https://selectstarsql.com/beazley.html</a>
This SQL murder mystery is fun and helpful! <a href="https://mystery.knightlab.com/" rel="nofollow">https://mystery.knightlab.com/</a>
At beginner level, there is SQL Island <a href="https://sql-island.informatik.uni-kl.de" rel="nofollow">https://sql-island.informatik.uni-kl.de</a>, with versions in German, English and French.
Codesignal has a fun Database “Arcade” <a href="https://app.codesignal.com/arcade/db" rel="nofollow">https://app.codesignal.com/arcade/db</a>
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.<p>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.<p>[1] <a href="https://projecteuler.net/" rel="nofollow">https://projecteuler.net/</a>
UPDATE POSTS SET VOTE_COUNT = VOTE_COUNT + 1 WHERE POST_ID = CURRENT_POST_ID();<p>CREATE TABLE SQL_GAMES blah blah blah<p>INSERT INTO SQL_GAMES many invited users blah blah blah<p>SELECT * FROM SQL_GAMES
WHERE users are having fun blah blah blah<p>PROFIT blah blah blah<p>ENJOY even more blah<p>-- TODO: drastically restructure above schema and SQL statements to make more sense blah blah blah<p>-- there's your game blah blah blah