CHAPTER 7

image

Constraints

It is important to design databases in a way that makes efficient processing and querying of the data possible. That by itself, however, it is not enough. We must make sure that the data we get from the database can be trusted. Think about the Order Entry system, for example. We can query the OrderLineItems table to get the information about products we sold, but we cannot trust the results unless we know that the table has no orphaned rows, which do not belong to any orders in our system.

Constraints allow us to declare the data integrity and business rules for the database and have SQL Server enforce them. They ensure ...

Get Pro SQL Server Internals 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.