Constraints
Data Integrity and Data Security are the most important factors in deciding the success of a system. The Constraints are a mechanism used through Oracle to restrict invalid data from being entered into the table and thus maintain the integrity of the data. They are or else called as Business Rules. These constraints can be widely classified into 3 types that are as follows:
• Entity Integrity Constraints
• Domain Integrity Constraints
• Referential Integrity Constraints
Entity Integrity Constraint
Entity Integrity constraints can be following types
• PRIMARY KEY
• UNIQUE KEY
Choosing a table’s Primary Key
A primary key permit each row in a table to be uniquely identified and ensures which no duplicate rows exist and no null values are entered. Selecting a primary key required the following guidelines:
• Select a column whose data values are unique.
• Select a column whose data values never change.
A primary key value is used to identify a row in the table. Thus, primary key values must not contain any data which is used for any other purpose. The Primary key can hold one or more columns of the similar table. Both they form a composite Primary Key.
Using UNIQUE Key Constraints
Unique key constraint is used to avoid the duplication of key values within the rows of a table. If values are entered into a column described with a unique key and repeating the similar data for which column is not possible but it can contain any number of null values. According to the Oracle, one null is not equal to another null.