SQL and Relational Theory: How to Write Accurate SQL Code

Front Cover
"O'Reilly Media, Inc.", Jan 23, 2009 - Computers - 428 pages
5 Reviews

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.

  

What people are saying - Write a review

User ratings

5 stars
1
4 stars
1
3 stars
2
2 stars
1
1 star
0

LibraryThing Review

User Review  - tlockney - LibraryThing

Reading this on my phone as an epub, so it's a bit slow going. I have the older edition of this in print, but it's changed enough that I'm trying to stick to the newer material. Read full review

Review: SQL and Relational Theory: How to Write Accurate SQL Code

User Review  - Paul - Goodreads

CJ Date is angry. He's been working with the relational algebra for a long time—longer than SQL's been around—and he wishes people would use it. He wrote Databases, Types, and the Relational Model ... Read full review

Contents

Setting the Scene
1
Types and Domains
27
Tuples and Relations Rows and Tables
53
No Duplicates No Nulls
71
Base Relvars Base Tables
89
The Original Operators
107
Additional Operators
133
SQL and Constraints
161
SQL and Logic
205
Using Logic to Formulate SQL Expressions
233
Miscellaneous SQL Topics
255
The Relational Model
269
Database Design Theory
285
Answers to Exercises
313
Suggestions for Further Reading
389
Index
397

SQL and Views
185

Common terms and phrases

About the author (2009)

Chris Date has a stature in the database industry that's unique. He enjoys a reputation that's second to none for his ability to explain complex technical issues in a clear and understandable fashion. His previous books for O'Reilly include SQL and Relational Theory (2nd edition); Database Design and Relational Theory; and View Updating and Relational Theory. The present book serves as an introduction to those previous ones.

Bibliographic information