Relational Models IV (Teachers Slide)
Relational Models IV (Teachers Slide)
Relational Models IV (Teachers Slide)
IV
Learning Objectives
1. Explain the Constraints Types (check
constraints, NOT NULL Constraints)
2. Introduction to constraints (Integrity, Primary
Key constraints, Foreign key constraints,
unique constraints).
CONSTRAINTS
SAMPLE:
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25),
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID, NAME));
To create a PRIMARY KEY constraints on the “ID”
and “NAME” columns when CUSTOMERS table
already exist, use the SQL syntax: