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

Get Visual Basic® .NET Database Programming 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.