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.