PRIMARY KEY: PRIMARY KEY(id) : Uniquely identify each row in table

UNIQUE: UNIQUE(email) : Enforce unique values in column

NOT NULL: name VARCHAR(100) NOT NULL : Require column to always have a value

DEFAULT: status CHAR(1) DEFAULT 'A' : Set value when none provided

CHECK: CHECK(qty>=0) : Validate column values against rule

FOREIGN KEY: FOREIGN KEY(dept_id) REFERENCES dept(id) : Maintain referential integrity between
tables

ON DELETE CASCADE: ON DELETE CASCADE : Automatically delete child rows when parent removed

ON UPDATE SET NULL: ON UPDATE SET NULL : Set foreign key to NULL when parent key changes
Previous Next