Need for integrity constraints

Integrity constraints are necessary because data in a database must be valid and consistent at all times. Data might be inconsistent because of entry errors, duplicate entries of rows, or other violations.

For example, to properly track a company's employee information, each employee should be assigned a unique identification number. To ensure this, specify a UNIQUE constraint on the column that contains the employee number (emp_no), as shown in the following example.

 CREATE TABLE employee_info (
          emp_no      INTEGER NOT NULL UNIQUE,
          first_name  VARCHAR(20) NOT NULL,
          last_name   VARCHAR(20) NOT NULL,
          title       VARCHAR(20)
     ) ;