What's the best website to learn and practice SQL?
![](https://programming.dev/pictrs/image/8140dda6-9512-4297-ac17-d303638c90a6.png)
I'm looking for a website where I can practice SQL by doing challenges. Like something where it provides you with some tables and you're tasked with writing a script to achieve a certain output. I know how to do basic SELECT and UPDATE commands and stuff, but I need a way to practice writing more complex scripts. What do you guys recommend?
https://mystery.knightlab.com/
The SQL Murder Mystery, of course!
Codewars. It has Postgres as one of the languages.
I second this. Learn Postgres as a beginner, it's SQL standard compliant and it has the amazing EXPLAIN feature (just add EXPLAIN in front of any query). People who start on MySQL or MariaDB have a harder time learning proper SQL concepts later.
https://selectstarsql.com/ is one I point folks to quite often
This is weirdly morbid and controversial for a programming tutorial. Can't say I've ever practiced SQL queries on execution records before. But I'll check it out
Your comment made me curious, so I looked around the website and found this.
Just a warning for folks who might not be in a good mental spot for seeing this in their SQL tutorial right now, or even just if it wouldn't be to your personal tastes. It's not your average school exercise but with morbid flavoring, the site really integrates its data. It provides a lot more information about capital punishment than you strictly need to solve the database problems. That works nicely with their intention of "Exercises should be realistic and substantial".
I think the general idea has a lot of merit. I don't know about execution records specifically (no death penalty in Canada for many decades), but government data sets in general.
I retired from database stuff a decade ago, but would jump at the chance to take a course that used Canadian data from various levels of government and public institutions.
Do people actually say "select star"? When I read SQL I always say "select all" because it reads better.
They most definitely do.
Execute program is another online learning tool that teaches SQL. I have used it for typescript lessons and like it a lot.
I liked GalaxQL.
Sqlbolt has been good so far, just started myself