SQL and Relational Theory

How to Write Accurate SQL Code

By C.J. Date
January 2009
Pages: 426
Series: Theory In Practice
ISBN 10: 0-596-52306-8 | ISBN 13: 9780596523060
Press Release
starstarstarstarstar (4) (Average of 1 Customer Reviews)

Buy 2 Get 1 Free Free ShippingGuarantee

Description

Understanding SQL's underlying theory is the best way to guarantee that your SQL code is correct and your database schema is robust and maintainable. In SQL and Relational Theory, author C.J. Date demonstrates how you can apply relational theory directly to your use of SQL, with numerous examples and clear explanations of the reasoning behind them. Anyone with a modest to advanced background in SQL will benefit from the many insights in this book.
Full Description

Understanding SQL's underlying theory is the best way to guarantee that your SQL code is correct and your database schema is robust and maintainable. On the other hand, if you're not well versed in the theory, you can fall into several traps. In SQL and Relational Theory, author C.J. Date demonstrates how you can apply relational theory directly to your use of SQL. With numerous examples and clear explanations of the reasoning behind them, you'll learn how to deal with common SQL dilemmas, such as:
  • Should database access granted be through views instead of base tables?
  • Nulls in your database are causing you to get wrong answers. Why? What can you do about it?
  • Could you write an SQL query to find employees who have never been in the same department for more than six months at a time?
  • SQL supports "quantified comparisons," but they're better avoided. Why? How do you avoid them?
  • Constraints are crucially important, but most SQL products don't support them properly. What can you do to resolve this situation?

Database theory and practice have evolved since Edgar Codd originally defined the relational model back in 1969. Independent of any SQL products, SQL and Relational Theory draws on decades of research to present the most up-to-date treatment of the material available anywhere. Anyone with a modest to advanced background in SQL will benefit from the many insights in this book.




Featured customer reviews

Write a Review


Theory to Practice,  May 27 2009
Rating: StarStarStarStarStar
Submitted by Stuart Ainsworth   [Respond | View]

When I first got this book I was very excited; the author, C.J. Date is one of those names that you hear tossed around with Codd. I was hoping that this book would be a good refresher on basic SQL theorems and relational design, and while I was not disappointed, I was a bit overwhelmed by the third chapter. Having recently seen the latest incarnation of Star Trek, I thought a science-fiction metaphor might be appropriate.

Reading this book made me realize that I’m an engineer; I am Scotty. I know how my particular environment works, I know when “I’m giving her all she’s got”, and I know how to tweak the system to keep it afloat when pressed with stressful situations. SQL Server is a wonderful platform, but like all database systems, it’s got its own peculiar quirks. Like all good engineers, you can learn to make the best of those quirks, but it doesn’t mean you understand how the engine is supposed to work.

Date is definitely Spock; beyond the logical comparisons (pardon the pun), Date’s focus is on the theory of how the relational model is supposed to work, not necessarily how SQL is implemented in the various database platforms. Very early on, he distinguishes between the relational model and SQL, and it became increasingly clear as I read this book that SQL <> relational model. Date tries his best to explain a very complex subject in a very thorough method, but I’m afraid that I’m not one of his best students.

The math involved in the relational model is very complex, and at times, I found myself frustrated with a passage because I knew how to do something in SQL, but had no clue as to what Date was saying in a relational language. That’s both sad and liberating in a way; I walked away from this book knowing first that I’m comfortable being an engineer, and second that I need to re-read this material occasionally. Date is like broccoli; he’ll never be my favorite author, but I know that what he’s writing is good for me.

--Please note that I originally posted this review at http://atlantamdf.blogspot.com (http://atlantamdf.blogspot.com) - Stu

Read all reviews


Media reviews
"One of the founding fathers of relational databases has made the theory accessible to every DBA in SQL and Relational Theory. For years I've wished that more practicing DBAs would understand the relational theory I learned while getting my Master's Degree; now I can just refer them to this book!"
-- Sheeri K. Cabral, Database Team Lead and MySQL Evangelist


"If you want some fascinating, and sometimes difficult to grasp background and theory that will likely make you a better database wizard, this book is likely to help you get there...There are excellent examples of SQL code throughout the book, great discussions of the mathematics behind the genesis of relational theory, and more. Beware, though, you may have to work to understand it, but it will be worthwhile for those who do."
-- Matthew Helmke, MatthewHelmke.net



Read all reviews

See larger cover