A database is a set of data. But, is the data kept in a database trustworthy? To answer that query we must first answer the question. What is integrity?
Integrity simply means to keep the consistency of data. Therefore, integrity constraints in a database make sure that changes made to the database by authorised users do not compromise data consistency. Therefore, integrity constraints do not permit damage to the database.
There are primarily two integrity constraints: the referential integrity constraint and the entity integrity constraint. In order to describe these two, let us first describe the term Key with respect to a Database Management System.