CONSTRAINTS Constraints is a rule which enforce entry of only valid data in table. Constraints prevent the deletion of a table if there are dependencies. Types of Constraints:- ➥ PRIMARY KEY= (unique + not null) ➥ FOREIGN KEY ➥ NOT NULL ➥ UNIQUE ➥ CHECK ➧PRIMARY KEY:- Specifies the column that uniquely identifies a row in the table. The identified columns must be defined as NOT NULL. ➧FOREIGN KEY:- Specifies that the values in the column must correspond to values in a referenced primary key or unique key column. ➧NOT NULL:- Specifies that this column cannot hold NULL values. ➧UNIQUE:- Specifies that values in the column must be unique. Column can contain NULL value. ➧CHECK:- Specifies Domain for Column values. A CONSTRAINT can be one of the following: * A ...
Learn SQL from basic to advance.