Chapter 16. Specifying Integrity Constraints

Introduction

Chapter 1, “Introduction to SQL,” discusses enforcement of data integrity in the database as one of the most important responsibilities of a database server. By data integrity, we mean consistency and correctness of the data. Data is consistent if individual items do not contradict one another. Data is correct if it satisfies all relevant rules, which can be company rules but may also be tax rules, laws of nature, and so on. For example, if in the example database the total number of sets in a match is greater than five, this data item is incorrect.

SQL can handle data integrity if so-called integrity constraints (or constraints) are defined. After each update, SQL tests whether the new database ...

Get Introduction to SQL: Mastering the Relational Database Language, Fourth Edition/20th Anniversary Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.