Ask HN: What is the best online resource to learn advanced SQL?
[self plug]On https://pgexercises.com I focus quite a bit on developing a mental model for SQL. I would suggest not skipping the easier exercises -  even if you can do the SQL, you might find the explanations useful.