Lurker News
I too often find myself getting stuck when it comes to more advanced SQL queries. I have never actively learnt SQL and realise that I don't have a great mental model of how it works. I would like to improve this as it is killing my productivity from time to time.

Comments (97) 45 threads

Earlier comments
JoeDaDude1 reply#
Gamify! Play the SQL game, The Schemaverse [1]. I don't know if this matches the request for "more advanced queries", but it is entertaining.

[1] https://schemaverse.com/

abstrct#
With the ability to use pl/pgsql within the game, it can get as complicated as you want :)

It doesn't necessarily teach each advanced technique, but it does give you a good place to practice what you've learned.
(Thanks for the mention!)

neovintage1 reply#
I would start with the Mode Analytics SQL tutorial. It's fairly robust and gets into advanced topics: https://community.modeanalytics.com/sql/tutorial/introductio...

That will get you pretty far but the advanced SQL topics will require the study of what the underlying database provides and how it works. Every database is different in terms of how it implements advanced features, if at all. For example, MySQL doesn't have window functions. For postgres related topics, the documentation is excellent, postgresguide.com gives a high level overview, or you can follow craig's blog (http://www.craigkerstiens.com/) that provides a gentle introduction to many of these topics as well.

Dowwie#
The Postgres Weekly newsletter is a really valuable service. You not only aggregate information but filter for quality. Thank you for providing this! I've said this before but it warrants re-mentioning :)
dizzystar#
Not online, but SQL Antipatterns is the book that had the largest impact on my thinking:

https://www.amazon.com/SQL-Antipatterns-Programming-Pragmati...
But as you said, you haven't actively learned SQL, so probably need to find some free data sets to work with.
You can probably start with Data is Plural. That will, at least, give you some raw data sets so you can get started on learning how to build up a database from unorganized data first:
https://tinyletter.com/data-is-plural
Edit to add: First and foremost, you have to learn normalization. Without that, you aren't doing any SQL.

Load more comments