Joe Celko's SQL Programming Style

‘A Manual of Style’ for the SQL Programmer

Review by SQL-Server-Peformance.Com

Joe Celko’s SQL Programming Style
By Joe Celko
272 pages. Morgan Kaufmann. $29.95.

Find out more about this book, or purchase it, from

When you look at today’s software applications, you’ll find that almost every application works with data in one way or another. Many times that data is stored in a database. Most software developers now work more or less regularly with databases.

Database development, however, is quite a bit different from application programming. Naturally, a good application developer isn’t necessarily also a good database developer. And it’s not really important whether the database you work with is a desktop database like Microsoft Access or a full-blown relational database server like SQL Server. Paradigms, guidelines, or frameworks that are true in application development aren’t necessarily true in database development, and can even be detrimental to it. Clearly, database development needs “style” rules, too. That’s where this book comes into play.

Joe Celko, maybe one the most prominent representatives of the database community these days, has written some of the best books about SQL programming in general. This book, however, is different. “SQL Programming Style” doesn’t teach you how to become a better SQL developer with SQL puzzles and brainteasers. Rather, it shows you “how to work in logical and declarative terms,” as the chapter titles suggest:

  • Names and Data Elements
  • Fonts, Punctuation, and Spacing
  • Data Declaration Language
  • Scales and Measurements Data Encoding Schemes
  • Coding Choices
  • How to use VIEWS
  • How to write Stored Procedures
  • Heuristics
  • Thinking in SQL
  • Resources
  • Bibliography

Celko provides guidelines for database development. Whether it is a discussion about good naming conventions, how to type and indent code, why auto-numbers (aka SQL Server’s IDENTITY property) may or may not make a good key, or where CHECK constraints should be placed in the code — this is database development, as it should be done, at least in his view.

Some of the rules in the book are (I hope) common sense, some of them are backed up by international standards, and some are more Celko specific. All rules include the reasoning behind why they should be used, which makes “SQL Programming Style” more of a reference book than one you read chapter by chapter. When in doubt, look it up. Even if you don’t agree with all the rules Celko presents, you can use this book as a building block for your own programming style.

There is a strong need for a set of good database coding guidelines. A clear and consistent programming style makes life easier for the database developer and, even more importantly, the developer that actually maintains the code. “SQL Programming Style” will help you develop that style. Of course, many of the rules aren’t new to people who follow some of the online communities in which Celko participates, but they are handily summarized here, all in one place. This alone makes it a good buy.


Categorized as Books

Leave a comment

Your email address will not be published.