Constraints
A constraint is a condition placed on the fields in a database table. For example, you might require that the value in a certain numeric field be between 1 and 100.
A referential constraint is one where a field is related to another field. For example, you might require that the CustomerId field in a new Orders record have a value that matches the CustomerId field in some record in the Customers table. In other words, the database cannot use a CustomerId in the Orders table unless that CustomerId has already been defined in the Customers table. That is sensible because it would be illogical to allow an order without a customer to place the order.
Referential constraints protect the database from garbage data. The user interface ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access