Save
sql
WEEK 8
Save
Share
Learn
Content
Leaderboard
Learn
Created by
yoyoyo
Visit profile
Cards (12)
SQL Constraints
- These rules control the data that can be stored in a column
NOT NULL CONSTRAINT
- in a column means that the column cannot store NULL values
UNIQUE CONSTRAINT
- in a column means that the column must have unique value.
PRIMARY KEY CONSTRAINT
- is simply a combination of NOT NULL and UNIQUE constraints.
FOREIGN KEY CONSTRAINT
- in a column is used to reference a record that exists in another table.
CHECK CONSTRAINT
- checks the condition before allowing values in a table.
DEFAULT
CONSTRAINT
- is used to set the default value if we try to store NULL in a column.
CREATE INDEX CONSTRAINT
- it's faster to retrieve data if we use that column for data retrieval.
Cascading Referential Integrity Constraints
- you can define the actions that the Database Engine takes when a user tries to delete or update a key
NO ACTION
- The Database Engine raises an error and the delete or update action on the row in the parent table is rolled back.
CASCADE
- Corresponding rows are updated or deleted in the referencing table when that row is updated or deleted in the parent table.
SET
NULL
- All the values that make up the foreign key are set to NULL when the corresponding row in the parent table is updated or deleted.