Thursday , March 28 2024
Do you want to write accurate queries?

Book Review: SQL And Relational Theory: How To Write Accurate SQL Code by C. J. Date

SQL And Relational Theory is the counterpart and work book to the 16 hour video training program SQL And Relational Theory Master Class by the same author who is both an expert in the field and can lay out the principles in a way that is easily understood.

Just because you work with SQL server does not make you a master at it. But by taking the time and learning SQL’s underlying theory, you have the best guarantee that your SQL code will be correct and that your system will be robust and maintainable. In SQL And Relational Theory, you will learn how to apply relational theory directly to your use of SQL.

For this book, it is assumed that you are a database practitioner and reasonably familiar with SQL. It is also assumed that you have a working knowledge of either the SQL standard or at least one SQL product. It is not presumed that you have a deep knowledge of relational theory. This book contains 12 chapters and is 432 pages in length.

1, “Setting the Scene,” begins by looking at the relational model as well as a discussion on terms and how the ones that are most common are the ones that cause the most confusion – these include the terms table, row, and column. There is also a review of the original relational model.

2, “Types and Domains,” shows that relations can have attributes of any type and that these can be as complex as you like. Here you will learn about types and relations, what a type is, type checking, and collations in SQL.

3, “Tuples and Relations, Rows and Tables,” takes a careful look at tuples and relations (what are referred to as rows and tables, in SQL parlance) which are the fundamental building blocks of the relational model. Here the author defines these concepts more precisely and what the consequences are of these more precise definitions.

4, “No Duplicates, No Nulls,” are two of the most obvious SQL departures from the relational model. Here you will see what is wrong with duplicates, the issues that they can have, and how to avoid them. Then you will see the same discussions about the effects of null values on your implementation.

5, “Base Relvars, Base Tables,” takes a closer look at the differences between relation values – relations, and relation variables – relvars. In this chapter you will take at the issues that are relevant to relvars in particular.

6, “SQL and Relational Algebra I: The Original Operators,” discusses the original relational operators (join, union, intersect, etc.) in depth. It also examines certain ancillary but important issues such as the significance of proper attribute (or column) naming.

7, “SQL and Relational Algebra II: The Original Operators,” now looks at the various additional operators and algebraic concepts that have been added since the first relational model was designed such as matching, extend, aggregation, image relations, and a variety of related issues.

8, “SQL and Constraints,” takes a look at constraints and how these are one of the most important database topics of all. There are generally two types – type constraints and database constraints. Here you will look at both. Because of the fact that constraints are widely misunderstood, this session examines constraints in depth, and debunks a few myths along the way.

9, “SQL and Views,” now takes on another topic that is also misunderstood. Like constraints, views are surrounded by numerous misconceptions. There are several ways of looking at what a view is, all of which are valid and all of which can be helpful in the right circumstance.

10, “SQL and Logic,” shows that there is an alternative to the relational algebra called the relational calculus. This means that queries, constraints, and view definitions can be formulated in calculus terms as well. Here you will see why a calculus formulation may prove easier than its algebraic counterpart.

11, “Using Logic to Formulate SQL Expressions,” looks at expression transformation that were brought up in chapter 6. Now you will see how to take the logical or relational calculus formulation of some query or constraint and map it systematically.

12, “Miscellaneous SQL Topics,” now takes on something of a cornucopia of ideas. It discusses a few SQL features that, for one reason or another, don’t fit very neatly into any of the previous sessions.

There are also four appendixes “The Relational Model,” “Database Design Theory,” “Answers to Exercises,” and “Suggestions for Further Reading”.

SQL And Relational Theory is not for beginners to the world of SQL. It is for those who are database professionals and want to pursue becoming masters at their craft. There is a lot of technical information here. This book is about theory and is not about a specific implementation.

If you have been working in SQL and have a fundamental idea on how databases work, SQL And Relational Theory will show how they are supposed to work and how you can improve your skills as well as your ability create bulletproof database systems.

If you are a database professional who knows SQL reasonably well and wants to learn both more about SQL as well as gain a firm foundation on the principles of relational theory then I wholeheartedly, very highly recommend SQL And Relational Theory.

About T. Michael Testi

Photographer, writer, software engineer, educator, and maker of fine images.

Check Also

The Wonderful World of Bookmarks!

Surprisingly, despite the popularity of eBooks, there is a wide range of all kinds of bookmarks available.