## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

## Book Description

SQL is full of difficulties and traps for the unwary. You can avoid them if you understand relational theory, but only if you know how to put the theory into practice. In this insightful book, author C.J. Date explains relational theory in depth, and demonstrates through numerous examples and exercises how you can apply it directly to your use of SQL.

1. SQL and Relational Theory
2. Dedication
3. Preface to the First Edition
4. Preface to the Second Edition
5. 1. Setting the Scene
1. THE RELATIONAL MODEL IS MUCH MISUNDERSTOOD
2. SOME REMARKS ON TERMINOLOGY
3. PRINCIPLES NOT PRODUCTS
4. A REVIEW OF THE ORIGINAL MODEL
5. MODEL vs. IMPLEMENTATION
6. PROPERTIES OF RELATIONS
7. BASE vs. DERIVED RELATIONS
8. RELATIONS vs. RELVARS
9. VALUES vs. VARIABLES
10. CONCLUDING REMARKS
11. EXERCISES
6. 2. Types and Domains
7. 3. Tuples and Relations, Rows and Tables
1. WHAT’S A TUPLE?
2. ROWS IN SQL
3. WHAT’S A RELATION?
4. RELATIONS AND THEIR BODIES
5. RELATIONS ARE n-DIMENSIONAL
6. RELATIONAL COMPARISONS
7. TABLE_DUM AND TABLE_DEE
8. TABLES IN SQL
9. COLUMN NAMING IN SQL
10. CONCLUDING REMARKS
11. EXERCISES
8. 4. No Duplicates, No Nulls
9. 5. Base Relvars, Base Tables
1. UPDATING IS SET LEVEL
2. RELATIONAL ASSIGNMENT
3. MORE ON CANDIDATE KEYS
4. MORE ON FOREIGN KEYS
5. RELVARS AND PREDICATES
6. RELATIONS vs. TYPES
7. EXERCISES
10. 6. SQL and Relational Algebra I: The Original Operators
1. SOME PRELIMINARIES
2. MORE ON CLOSURE
3. RESTRICTION
4. PROJECTION
5. JOIN
6. UNION, INTERSECTION, AND DIFFERENCE
7. WHICH OPERATORS ARE PRIMITIVE?
8. FORMULATING EXPRESSIONS ONE STEP AT A TIME
9. WHAT DO RELATIONAL EXPRESSIONS MEAN?
10. EVALUATING SQL TABLE EXPRESSIONS
11. EXPRESSION TRANSFORMATION
12. THE RELIANCE ON ATTRIBUTE NAMES
13. EXERCISES
11. 7. SQL and Relational Algebra II : Additional Operators
1. EXCLUSIVE UNION
2. SEMIJOIN AND SEMIDIFFERENCE
3. EXTEND
4. IMAGE RELATIONS
5. DIVIDE
6. AGGREGATE OPERATORS
7. IMAGE RELATIONS bis
8. SUMMARIZATION
9. SUMMARIZATION bis
10. GROUP, UNGROUP, AND RELATION VALUED ATTRIBUTES
11. “WHAT IF” QUERIES
12. A NOTE ON RECURSION
14. EXERCISES
12. 8. SQL and Constraints
1. TYPE CONSTRAINTS
2. TYPE CONSTRAINTS IN SQL
3. DATABASE CONSTRAINTS
4. DATABASE CONSTRAINTS IN SQL
5. TRANSACTIONS
6. WHY DATABASE CONSTRAINT CHECKING MUST BE IMMEDIATE
7. BUT DOESN’T SOME CHECKING HAVE TO BE DEFERRED?
8. CONSTRAINTS AND PREDICATES
9. MISCELLANEOUS ISSUES
10. EXERCISES
13. 9. SQL and Views
1. VIEWS ARE RELVARS
2. VIEWS AND PREDICATES
3. RETRIEVAL OPERATIONS
4. VIEWS AND CONSTRAINTS
5. UPDATE OPERATIONS
6. WHAT ARE VIEWS FOR?
7. VIEWS AND SNAPSHOTS
8. EXERCISES
14. 10. SQL and Logic
1. WHY DO WE NEED LOGIC?
2. SIMPLE AND COMPOUND PROPOSITIONS
3. SIMPLE AND COMPOUND PREDICATES
4. QUANTIFICATION
5. RELATIONAL CALCULUS
6. MORE ON QUANTIFICATION
7. SOME EQUIVALENCES
8. CONCLUDING REMARKS
9. EXERCISES
15. 11. Using Logic to Formulate SQL Expressions
16. 12. Miscellaneous SQL Topics
1. SELECT *
2. EXPLICIT TABLES
3. NAME QUALIFICATION
4. RANGE VARIABLES
5. SUBQUERIES
6. “POSSIBLY NONDETERMINISTIC” EXPRESSIONS
7. EMPTY SETS
8. A SIMPLIFIED BNF GRAMMAR
9. EXERCISES
17. A. The Relational Model
1. THE RELATIONAL MODEL vs. OTHERS
2. THE SIGNIFICANCE OF THEORY
3. THE RELATIONAL MODEL DEFINED
4. DATABASE VARIABLES
5. OBJECTIVES OF THE RELATIONAL MODEL
6. SOME DATABASE PRINCIPLES
7. WHAT REMAINS TO BE DONE?
18. B. SQL Departures from the Relational Model
19. C. A Relational Approach to Missing Information
20. D. A Tutorial D Grammar
21. E. Summary of Recommendations