Chapter 21. Specifying Integrity Constraints

21.1 Introduction

Chapter 1, “Introduction to MySQL,” discussed the fact that enforcement of data integrity in the database is 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 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.

MySQL can take care of data integrity if integrity constraints (or constraints) are defined. After each update, MySQL tests ...

Get SQL for MySQL Developers: A Comprehensive Tutorial and Reference 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.