Skip to content

Reading up on SQL

About four weeks ago I read a manga introduction to databases that I enjoyed thoroughly and reviewed. As I mentioned in that review, that sparked an interest in learning more. I’ve used databases for years, and my simple level of experience has served me well, but now I want to know more. I decided to start by brushing up on my knowledge of SQL. The three books discussed in this article are a good introduction. I have another book on my shelf that goes deeper into database theory and I will review that book later. Let’s start with a brief introduction to each of today’s books, which will be followed by a short comparison.

First, I read sitepoint‘s Simply SQL by Rudy Limeback.

I liked this book. It was easy to read and understand. I liked that the code focus is on using ANSI standard SQL as this gives knowledge that will work across platforms on multiple database systems from free options like MySQL to common proprietary ones like Oracle and SQL Server. The examples are clear and well written and the figures are wonderful (as is usual in sitepoint products).

This book is not intended for people who wish to learn to become database administrators. It was written for web developers who want to have a better understanding of the basics of SQL. This is an important fact. If you fit this role, this book is excellent.

The coding style was easy to read, but there were some odd quirks that I didn’t like. For example, as noted by the author himself, he likes to put commas at the beginning of lines when making lists. This is the only place I have ever seen that done. Now, this isn’t technically wrong, but it is unusual. I would have preferred to see code examples written with strict adherence to commonly accepted standards as this makes the task of reading other people’s code or writing good and readable code easier. However, I guess doing it this way can also be seen as a benefit as it will remind the reader that there is more than one way to do things, and that in the real world he will be sure to encounter non-standard methods and have to adapt. Honestly, that is my only big complaint about the book, and it isn’t a deal breaker.

Next, I read the new second edition of O’Reilly‘s Learning SQL by Alan Beaulieu.

If a person is looking to become a database administrator, or just needs to get up to speed on the basics with some understanding of what they are doing and why, this is an excellent place to start. However, this book does require that you have some experience with computers, especially a base knowledge of what a database is and how or why programs might want to interact with one. This isn’t a book for someone who is a complete novice to the realm of data storage and interaction, but rather intended for people who know what they want to do and why and need an in depth manual for how to accomplish the task of storing, retrieving, and using data but who may be a complete novice at doing so using SQL.

I love that the book is written by a very experienced Oracle administrator, but uses MySQL (version 6.0! –the only book I have seen so far to do so since this release is so new) as the base for all examples and instruction. The book itself focuses on teaching the ANSI standard clearly and well, but gives great examples using one free and open source product that is available for any reader to download and install on their system, with instructions on how to do so. Then, the author discusses some of the differences that may be discovered by readers as they move into the real world and begin to interact with other database systems from other vendors.

The book uses examples that are well formed, clear, and which adhere well to standards. I especially appreciate that the examples use good coding technique that is easy to read and would be a joy to maintain in the wild if it were discovered by a person taking over responsibility for a database they did not create.

Finally, I picked up a copy of another O’Reilly book, SQL in a Nutshell by Kevin Kline with Daniel Kline and Brand Hunt, which just released a third edition that is greatly expanded

This book is intended as a reference, not an instructional text. It serves this purpose well with pages and pages of great examples. The book is not focused on databases and SQL from a specific vendor, but gives great data and comparisons of commands and queries using ANSI SQL (SQL2003, aka SQL3) and then adjusting as needed for MySQL 5.1, Oracle 11g, PostgreSQL 8.2.1, and Microsoft SQL Server 2008. If you are responsible for moving data from one vendor’s product to another, or if you are responsible for databases from multiple vendors, this book could be a Godsend. Really, if you only use one of these products, the book is still a great value.

Keep in mind, this is not an instruction manual. This is a compilation of commands with examples. The goal is not to lead gently, but to get directly to the meat of using SQL, to give clear and detailed information about each command, its syntax and options, and several examples of usage. If that is what you are looking for, and especially a book with comparisons across platforms, this book will serve you very well.


Each of these books does a good job of fulfilling its goal of communicating to a specific audience. They all cover the basics, and the first two do a great job of teaching them in a logical and clear order, but in varying depth. If you are interested in learning SQL, hopefully this will help you determine if one of these offerings would be useful to you.

For people focused on web design and who only want to learn some of the basics, I feel quite good recommending Simply SQL. As with most of their offerings, this sitepoint book is dedicated to helping web developers improve their craft and they do a great job of serving that specific population. I was disappointed with the author’s decision to use his preferred coding style rather than the standard format, but the difference isn’t really so great as to be a huge problem.

I would imagine most people reading my blog would end up sharing my preference for Learning SQL. This second edition is clear, very well written, uses beautiful code examples, and has wonderful exercises at the end of each chapter (with solutions in the back of the book) to assist you in learning. I love how the book uses MySQL to teach, but doesn’t ultimately limit itself to only one database product and that the author has a wealth of real world experience using many products and takes time to discuss some of the differences without getting bogged down or too distracted from teaching good, portable ANSI SQL basics.

Finally, I don’t think the average person will have much use for SQL in a Nutshell, but for those who work with databases regularly, the book is sure to find a place of importance on the reference shelf. As I read through the examples, I appreciated how clearly and completely the different implementations of ANSI standards were delineated for each of the products covered and how differences from the standard were clearly noted and defined for each.


  1. Serge

    Try online training of practical skills in SQL (DML):

  2. Nepherte

    I’ve found Fundamentals of Database Systems by Elmasri & Navathe a good book if you want to digg deeper in the theory behind databases.

  3. Thank you for the recommendation! I’m currently reading (and will review) SQL and Relational Theory by C.J. Date, but a lot of the theory is new to me so it may take me some time to make sure I read it with understanding. I may follow it up with Fundamentals of Database Systems later. I definitely prefer to learn principles over implementations, because good principles can be applied to multiple and often changing implementations.

  4. Andreas Olsson

    After reading this blog entry I ended up ordering the book Learning SQL. Right now I’m working my way through this excellent book, and keep wondering why I haven’t gotten around to learn this stuff earlier. Thanks for pointing me in a very good direction!

  5. Thanks for the kind words, Andreas. I’m glad you found the review helpful.

  6. Thanks for the great and favourable review of Simply SQL, Matthew.

    As for the leading commas convention, hey, what can I say? It has numerous advantages, including making errors easier to spot (example on pages 51-52) and changes to the query easier to make when using the keyboard with a text editor; the Shift key together with the arrow keys can highlight, cut, and paste rows into and out of the SELECT clause without the nuisance of going up to the previous line to deal with that pesky trailing comma. One needs to work with leading commas only for a short while before the subtlety of its benefits becomes clear. I’m glad it wasn’t a “deal-breaker” for ya.

    Good luck with your SQL and if you ever have any questions, please do get in touch. ;o)


  7. Thanks for stopping in and commenting, Rudy!

Comments are closed.