- Sometimes we need to provide some restriction on the data for security and data integrity reason.
- We must ensure that only valid and complete data should be stored into the database.
- Oracle allows data integrity constraints to ensure data consistency and data integrity.
- They are known as integrity constrains.
- Oracle supports two type of integrity constrains:
- Constraints that control data insertion and data retrieval speed are known as I/O constraints.
- Business constraints are the constraints defined by the organization itself.
- They define business rules or policy.
- Constraints can be defined either at the time of table creation by using CREATE TABLE command or can be define on existing table by using ALTER TABLE command.
- It can be define either at table level or at column level.
Table level Constraints:
- Constraints that span across multiple columns are known as table level constraints.
- Table level constraints are defined after the table definition with CREATE TABLE command.
Column level Constraints:
- Constraints which are defined on a specific column are known as column level constraints.
- They are specific to single column.
- Fore more detail read our articles on I/O constraints and Business constraints.