Found in 1 comment on Hacker News
bitexploder · 2020-02-04 · Original thread
Everything I learned on is old school. Joe Celko was a great author back in the day. I always enjoyed this book:

https://www.amazon.com/Joe-Celkos-SQL-Smarties-Programming/d...

Although it is 10 years old, not much has changed in the universe of SQL basics. If I were to capture the essence of good schema design it is mostly about keeping data normalized until you have a really good reason not to. Denormalization is almost always an optimization choice.

And before you optimize you should have basic things covered, like indexes, etc. I have fixed more than one "slow" query by simply adding indicies to everything people are joining on. So, check out a tool like pgAdmin that has a cool query planner optimization feature. What is happening under the hood doesn't matter a /lot/ when learning SQL, but it is really insightful to see how indicies of various types impact performance. I believe this book basically covers it all from a theoretical perspective. Optimization and indices aren't super well covered in SQL for smarties, which make sense, it isn't about optimization but is a little higher level.

There are /tons/ of data sets out there now a days. CSV files, etc. Find some interesting data and start challenging yourself with interesting ways to design that data into a database. I actually design most of my SQL databases using an ORM these days, but, my bedrock knowledge of SQL makes it very efficient and I can avoid committing "SQL sins" (denormalization) prematurely. You will be surprised at how much you can learn on simple data sets :)

Fresh book recommendations delivered straight to your inbox every Thursday.