Entity and referential integrity in a database
What does it mean to say that a database displays both entity integrity and referential integrity? And why entity integrity and referential integrity important in a database? Provide an application example to support your discussion.
Sample Answer
Entity integrity and referential integrity are two important concepts in database design.
Entity integrity means that each row in a table must uniquely identify a single entity. This is typically achieved by having a primary key column. The primary key column is a column or set of columns that uniquely identifies each row in the table.
Referential integrity means that all foreign key values in a table must reference a valid primary key value in another table. A foreign key is a column or set of columns in one table that references the primary key of another table. Referential integrity ensures that the data in the database is consistent and that relationships between tables are maintained.