Loading lesson path
Overview
SQL constraints are rules for data in a table. Constraints are used to prevent insertion of invalid data in a table, and ensures the accuracy and reliability of the data in the table. If there is any violation between the constraint and the data action, the action is aborted. Constraints can be specified in two ways: When a table is created (through the CREATE TABLE statement)
(through the ALTER TABLE
statement)The following constraints are commonly used in SQL:
Uniquely identifies each row in a table (a combination of a NOT NULL and
)
Creates indexes on columns to retrieve data from the database faster