TechBookReport logo

Keywords: SQL, RDBMS, databases, database query

Title: Learning SQL

Author: Alan Beaulieu

Publisher: O'Reilly

ISBN: 0596007272

Media: Book

Level: Introductory

Verdict: Recommended


Knowledge of SQL is pretty much a core skill that every developer ought to have. Aside from embedded systems, just about every major programming domain depends on a database - whether it's for dynamic web pages, web services, desktop applications or just about anything else - being able to communicate with a database is a key skill. This book is expressly designed for those wanting to learn this skill, or seeking to brush up their existing knowledge.

Rather than learning SQL in a vacuum, the author has chosen to use the open source MySQL database as the main tool for teaching. This is a good choice in that it's widely available on range of platforms (Linux, Windows etc), and because it's easy to set up and use. What's more it comes with a handy command-line interface that makes it easy for entering commands and getting results out.

The opening couple of chapters put things in perspective and prepare the learning environment - some SQL history, downloading and installing MySQL and creating and populating a sample database. Note that the sample databases are available for download from the book's web site, which saves on keying in the data to populate the database. Finally, to check that things are ready to roll the second chapter introduces the basic SELECT query.

From chapter three onwards the book dives deeper and deeper into SQL territory - certainly deeper than a web-based resource such as the TechBookReport SQL tutorial. Chapters three and four looking at querying and filtering, providing a solid understanding of how to select, group and filter data from tables. There's a reasonable depth of treatment, with issues like null handling and building up complex filters well covered.

Joins, including self-joins, get covered in chapter five. Chapter six looks at set theory - which actually is one of the mathematical foundations of relational databases - and how these relate to real-world database use, for example with the Union operator. Data types are covered in chapter seven, including conversions, date handling and so on. For those worried about MySQL-specific code, this is flagged and the author takes pains to pick out those areas which are non-standard in MySQL or not covered at all. At several points there are examples for SQL Server and Oracle as well.

Chapters 8, 9 and 10 revisit grouping and aggregation, sub-queries and some of the more esoteric joins (such as the natural join). These chapters build well on the previous ones, and certainly the additional content adds value to the book. Yes this is an introduction to SQL, but it covers more than the absolute basics on querying. Transactions also get a chapter, as do indexes and constraints and there's also a chapter on conditional logic.

Of course this breadth of material wouldn't be worth squat if the writing was unclear or the examples too simplistic. That isn't a problem. The writing is admirably clear and does a good job in getting new concepts across to the reader. The examples are pitched at the right level too, and the book does make excellent use of the MySQL command-line. Each chapter includes exercises, so there's room for the reader to try things out and check his or her answers.

In all, this is a solid introduction to SQL, and is highly recommended.

Hit the 'back' key in your browser to return to subject index page

Return to home page

Contents © TechBookReport 2006. Published May 15 2006