SQL and Relational Theory: How to Write Accurate SQL Code [NOOK Book]

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 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.

This second edition includes new material on recursive queries, “missing information” without nulls, new update operators, and ...

See more details below
SQL and Relational Theory: How to Write Accurate SQL Code

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$17.99
BN.com price
(Save 43%)$31.99 List Price

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 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.

This second edition includes new material on recursive queries, “missing information” without nulls, new update operators, and topics such as aggregate operators, grouping and ungrouping, and view updating. If you have a modest-to-advanced background in SQL, you’ll learn how to deal with a host of common SQL dilemmas.

  • Why is proper column naming so important?
  • Nulls in your database are causing you to get wrong answers. Why? What can you do about it?
  • Is it possible to 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 the relational model was developed more than 40 years ago. SQL and Relational Theory draws on decades of research to present the most up-to-date treatment of SQL available.

C.J. Date has a stature that is unique within the database industry. A prolific writer well known for the bestselling textbook An Introduction to Database Systems (Addison-Wesley), he has an exceptionally clear style when writing about complex principles and theory.

Read More Show Less

Product Details

  • ISBN-13: 9781449319748
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/16/2011
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 2
  • Pages: 448
  • Sales rank: 420,991
  • File size: 8 MB

Meet 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.

Read More Show Less

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;

Read More Show Less

Customer Reviews

Average Rating 1
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(1)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Posted June 22, 2012

    Way too theoretical for me

    Way too much discussion of why a relation is not exactly a table and such

    0 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)