SQL and Relational Theory: How to Write Accurate SQL Code

SQL and Relational Theory: How to Write Accurate SQL Code

by Chris Date
SQL and Relational Theory: How to Write Accurate SQL Code

SQL and Relational Theory: How to Write Accurate SQL Code

by Chris Date

Paperback

$39.99 
  • SHIP THIS ITEM
    Qualifies for Free Shipping
  • PICK UP IN STORE
    Check Availability at Nearby Stores

Related collections and offers


Overview

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 that theory into practice. In this book, Chris Date explains relational theory in depth, and demonstrates through numerous examples and exercises how you can apply it to your use of SQL.

This third edition has been revised, extended, and improved throughout. Topics whose treatment has been expanded include data types and domains, table comparisons, image relations, aggregate operators and summarization, view updating, and subqueries. A special feature of this edition is a new appendix on NoSQL and relational theory.

  • Could you write an SQL query to find employees who have worked at least once in every programming department in the company? And be sure it’s correct?
  • Why is proper column naming so important?
  • Nulls in the database cause wrong answers. Why? What you can do about it?
  • How can image relations help you formulate complex SQL queries?
  • SQL supports "quantified comparisons," but they’re better avoided. Why? And how?

Database theory and practice have evolved considerably since Codd first defined the relational model, back in 1969. This book draws on decades of experience to present the most up to date treatment of the material available anywhere. Anyone with a modest to advanced background in SQL can benefit from the insights it contains. The book is product independent.


Product Details

ISBN-13: 9781491941171
Publisher: O'Reilly Media, Incorporated
Publication date: 11/27/2015
Pages: 581
Product dimensions: 7.00(w) x 9.20(h) x 1.40(d)

About the Author

C.J. Date has a stature that is unique within the database industry. C.J. is a prolific writer, and is well-known for his best-selling textbook: An Introduction to Database Systems (Addison Wesley). C.J. is an exceptionally clear-thinking writer who can lay out principles and theory in a way easily understood by his audience.

Table of Contents

Dedication; Preface to the First Edition; ; Preface to the Second Edition; Chapter 1: Setting the Scene; 1.1 THE RELATIONAL MODEL IS MUCH MISUNDERSTOOD; 1.2 SOME REMARKS ON TERMINOLOGY; 1.3 PRINCIPLES NOT PRODUCTS; 1.4 A REVIEW OF THE ORIGINAL MODEL; 1.5 MODEL vs. IMPLEMENTATION; 1.6 PROPERTIES OF RELATIONS; 1.7 BASE vs. DERIVED RELATIONS; 1.8 RELATIONS vs. RELVARS; 1.9 VALUES vs. VARIABLES; 1.10 CONCLUDING REMARKS; 1.11 EXERCISES; Chapter 2: Types and Domains; 2.1 TYPES AND RELATIONS; 2.2 EQUALITY COMPARISONS; 2.3 DATA VALUE ATOMICITY; 2.4 WHAT’S A TYPE?; 2.5 SCALAR vs. NONSCALAR TYPES; 2.6 SCALAR TYPES IN SQL; 2.7 TYPE CHECKING AND COERCION IN SQL; 2.8 COLLATIONS IN SQL; 2.9 ROW AND TABLE TYPES IN SQL; 2.10 CONCLUDING REMARKS; 2.11 EXERCISES; Chapter 3: Tuples and Relations, Rows and Tables; 3.1 WHAT’S A TUPLE?; 3.2 ROWS IN SQL; 3.3 WHAT’S A RELATION?; 3.4 RELATIONS AND THEIR BODIES; 3.5 RELATIONS ARE n-DIMENSIONAL; 3.6 RELATIONAL COMPARISONS; 3.7 TABLE_DUM AND TABLE_DEE; 3.8 TABLES IN SQL; 3.9 COLUMN NAMING IN SQL; 3.10 CONCLUDING REMARKS; 3.11 EXERCISES; Chapter 4: No Duplicates, No Nulls; 4.1 WHAT’S WRONG WITH DUPLICATES?; 4.2 DUPLICATES: FURTHER ISSUES; 4.3 AVOIDING DUPLICATES IN SQL; 4.4 WHAT’S WRONG WITH NULLS?; 4.5 AVOIDING NULLS IN SQL; 4.6 A REMARK ON OUTER JOIN; 4.7 CONCLUDING REMARKS; 4.8 EXERCISES; Chapter 5: Base Relvars, Base Tables; 5.1 UPDATING IS SET LEVEL; 5.2 RELATIONAL ASSIGNMENT; 5.3 MORE ON CANDIDATE KEYS; 5.4 MORE ON FOREIGN KEYS; 5.5 RELVARS AND PREDICATES; 5.6 RELATIONS vs. TYPES; 5.7 EXERCISES; Chapter 6: SQL and Relational Algebra I: The Original Operators; 6.1 SOME PRELIMINARIES; 6.2 MORE ON CLOSURE; 6.3 RESTRICTION; 6.4 PROJECTION; 6.5 JOIN; 6.6 UNION, INTERSECTION, AND DIFFERENCE; 6.7 WHICH OPERATORS ARE PRIMITIVE?; 6.8 FORMULATING EXPRESSIONS ONE STEP AT A TIME; 6.9 WHAT DO RELATIONAL EXPRESSIONS MEAN?; 6.10 EVALUATING SQL TABLE EXPRESSIONS; 6.11 EXPRESSION TRANSFORMATION; 6.12 THE RELIANCE ON ATTRIBUTE NAMES; 6.13 EXERCISES; Chapter 7: SQL and Relational Algebra II : Additional Operators; 7.1 EXCLUSIVE UNION; 7.2 SEMIJOIN AND SEMIDIFFERENCE; 7.3 EXTEND; 7.4 IMAGE RELATIONS; 7.5 DIVIDE; 7.6 AGGREGATE OPERATORS; 7.7 IMAGE RELATIONS bis; 7.8 SUMMARIZATION; 7.9 SUMMARIZATION bis; 7.10 GROUP, UNGROUP, AND RELATION VALUED ATTRIBUTES; 7.11 “WHAT IF” QUERIES; 7.12 A NOTE ON RECURSION; 7.13 WHAT ABOUT ORDER BY?; 7.14 EXERCISES; Chapter 8: SQL and Constraints; 8.1 TYPE CONSTRAINTS; 8.2 TYPE CONSTRAINTS IN SQL; 8.3 DATABASE CONSTRAINTS; 8.4 DATABASE CONSTRAINTS IN SQL; 8.5 TRANSACTIONS; 8.6 WHY DATABASE CONSTRAINT CHECKING MUST BE IMMEDIATE; 8.7 BUT DOESN’T SOME CHECKING HAVE TO BE DEFERRED?; 8.8 CONSTRAINTS AND PREDICATES; 8.9 MISCELLANEOUS ISSUES; 8.10 EXERCISES; Chapter 9: SQL and Views; 9.1 VIEWS ARE RELVARS; 9.2 VIEWS AND PREDICATES; 9.3 RETRIEVAL OPERATIONS; 9.4 VIEWS AND CONSTRAINTS; 9.5 UPDATE OPERATIONS; 9.6 WHAT ARE VIEWS FOR?; 9.7 VIEWS AND SNAPSHOTS; 9.8 EXERCISES; Chapter 10: SQL and Logic; 10.1 WHY DO WE NEED LOGIC?; 10.2 SIMPLE AND COMPOUND PROPOSITIONS; 10.3 SIMPLE AND COMPOUND PREDICATES; 10.4 QUANTIFICATION; 10.5 RELATIONAL CALCULUS; 10.6 MORE ON QUANTIFICATION; 10.7 SOME EQUIVALENCES; 10.8 CONCLUDING REMARKS; 10.9 EXERCISES; Chapter 11: Using Logic to Formulate SQL Expressions; 11.1 SOME TRANSFORMATION LAWS; 11.2 EXAMPLE 1: LOGICAL IMPLICATION; 11.3 EXAMPLE 2: UNIVERSAL QUANTIFICATION; 11.4 EXAMPLE 3: IMPLICATION AND UNIVERSAL QUANTIFICATION; 11.5 EXAMPLE 4: CORRELATED SUBQUERIES; 11.6 EXAMPLE 5: NAMING SUBEXPRESSIONS; 11.7 EXAMPLE 6: MORE ON NAMING SUBEXPRESSIONS; 11.8 EXAMPLE 7: DEALING WITH AMBIGUITY; 11.9 EXAMPLE 8: USING COUNT; 11.10 EXAMPLE 9: JOIN QUERIES; 11.11 EXAMPLE 10: UNIQUE QUANTIFICATION; 11.12 EXAMPLE 11: ALL OR ANY COMPARISONS; 11.13 EXAMPLE 12: GROUP BY AND HAVING; 11.14 EXERCISES; Chapter 12: Miscellaneous SQL Topics; 12.1 SELECT *; 12.2 EXPLICIT TABLES; 12.3 NAME QUALIFICATION; 12.4 RANGE VARIABLES; 12.5 SUBQUERIES; 12.6 “POSSIBLY NONDETERMINISTIC” EXPRESSIONS; 12.7 EMPTY SETS; 12.8 A SIMPLIFIED BNF GRAMMAR; 12.9 EXERCISES; The Relational Model; THE RELATIONAL MODEL vs. OTHERS; THE SIGNIFICANCE OF THEORY; THE RELATIONAL MODEL DEFINED; DATABASE VARIABLES; OBJECTIVES OF THE RELATIONAL MODEL; SOME DATABASE PRINCIPLES; WHAT REMAINS TO BE DONE?; SQL Departures from the Relational Model; A Relational Approach to Missing Information; VERTICAL DECOMPOSITION; HORIZONTAL DECOMPOSITION; WHAT DO THE SHADED ENTRIES MEAN?; CONSTRAINTS; QUERIES; MORE ON PREDICATES; EXERCISES; A Tutorial D Grammar; ; Summary of Recommendations; Answers to Exercises; CHAPTER 1; CHAPTER 2; CHAPTER 3; CHAPTER 4; CHAPTER 5; CHAPTER 6; CHAPTER 7; CHAPTER 8; CHAPTER 9; CHAPTER 10; CHAPTER 11; CHAPTER 12; APPENDIX C; Suggestions for Further Reading;
From the B&N Reads Blog

Customer Reviews