Bring Your SQL To The Next Level
When you start learning SQL and databases it is trivial to find good resources. My adventures started with ORACLE8i The Complete Reference. Tutorials are another way. With the official documentation for your RDBMS on hand you can learn the specific dialect of SQL you need. Later in your career you might cross the way of an SQL guru. In that point in time you wonder: How can I reach that level? I met quite a few over the years. Questions for recommendations stay often unanswered. Those guys breath SQL day in and day out. Most of their tricks they learned by practice. After some time consuming research I found a few books which brought me to the next level.
I often hear complains about the age of some books. To be honest with you: The mantra that the computer world is a fast changing one is a lie. Yes. There are a lot of moving targets. But we have a lot of technologies which are only changing slowly if at all. At least if you don’t look under the hood. UNIX, Linux, protocols like SNMP, HTTP, programming languages. A lot of tools are around for more than 20 years. So even from a book written 10 or more years ago you can learn a lot.
But let’s go through my list! In the beginning you need recipies for the problems in front of you. Don’t look further than the SQL Cookbook. Over 600 pages for most of your daily problems. I use it on a regular basis to solve the problem i have right now. SQL is just one side gick for me and my memory is not very good. No shame for using it side by side with your editor or SQL frontend.
As human beeings we tend to make all the same mistakes. To avoid some of them read SQL Antipatterns: Avoiding the Pitfalls of Database Programming. With 329 pages it wont take much time but will give you time back with the lessons learned.
More lessons with a practical background you will find in The Art of SQL. 370 pages giving you lots of thoughts. I am the first to admit that I had to read a few pages twice. Probably not a bed time lecture if you want to learn from it.
If you know a book missing in this list feel free to contact me. And always keep in mind: Some SQL statements are written in a day and not a minute. If they run often, are fast and deliver the right result it is well spend working time.
Two years have passed and I am still learning SQL. Shortly after I wrote this blog post the 2nd edition of SQL Cookbook came out. It got enough updates to qualify buying it again.
As Vertica is my main platform I got a copy of Making Databases Work - The Pragmatic Wisdom of Michael Stonebraker. It is not much about writing SQL but gives a brief history of databases. Starting in the 70s it gives some background around relational databases in general as well as insights into Ingres, Postgres, PostgreSQL, Vertica and others. Most chapters are easy to read because they tell you the circumstances. Others explain internals of the systems and algorithms. You get a better understanding how everything evolved over time and appreciate the technology.
For the next year I see a lot of database design heading into my direction. Luckily I got pointed to Kimball’s Data Warehouse Toolkit Classics 2nd Edition. The first book I could skim read. But the Data Warehouse Toolkit requires more time. The Data Warehouse Lifecycle Toolkit is no difference.
Hopefully as a shortcut I started reading The Kimball Group Reader: Relentlessly Practical Tools for Data Warehousing and Business Intelligence Remastered Collection. A collection of blog posts and articles. Still with 912 pages a lot of paper.
If your background is Data Analyses and you wonder what’s about this SQL thing you should get a copy of SQL for Data Analysis: Advanced Techniques for Transforming Data into Insights. Cathy Tanimura spend some extra time creating a GitHub repository. If your background differs it might help you understanding how data analysts tick.
From time to time you should check for new editions of the books you already have. SQL Cookbook got a rewrite in 2020.
Last year we were able to upgrade our Vertica system. With the new version we got stored procedures. You can learn a lot by reading code. And it doesn’t have to be your flavor of SQL. Having used Oracle databases in the past and knowing how important its PL/SQL is I searched for books around Oracle in this case.
Oracle PL/SQL Best Practices is not new being released in 2007. But I was more interested in concepts than latest features. As it is written more like a story around a fictive company you get an interesting read and learn something.
In the case of Oracle PL/SQL by Example i picked the 4th edition instead of the current 6th one. 762 pages versus 480. Oracle and Vertica are quite different so I wasn’t interested in the latest Oracle features. My biggest take away was the PL/SQL Formatting Guide which I disussed with my colleague and we made it our coding guide.
Real World SQL and PL/SQL: Advice from the Experts is a good book if you are working with Oracle. For a Vertica user there was not much in it.