From the course: Developing Microsoft SQL Server 2016 Databases

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Enforce referential integrity

Enforce referential integrity

- [Instructor] Referential integrity is concerned with the relationships between tables that make up relational databases such as those created with SQL Server. By enforcing referential integrity, the system checks to make sure that the related records actually exist in a parent table before allowing the child table to be populated. For instance, you would never want to issue a payroll check for an employee that didn't exist, or allow a customer to purchase a product that you don't even sell. Referential integrity protects you from these sorts of errors, but beyond simply checking that a proposed foreign key value exists in a related primary key field, referential integrity is also concerned with what happens when these values change. Let's first take a look at the case of a primary key value changing. When two companies merge it's not uncommon for employees from one company to get folded in to the human resources…

Contents