INTEGRITY CONSTRAINTS Dbms Presentation
INTEGRITY CONSTRAINTS Dbms Presentation
CONSTRAINTS
CONTENTS
INTRODUCTION-DEFINATION
FORMAT
NOT NULL
DEFAULT
UNIQUE
CHECK
PRIMARY KEY
FOREIGN KEY
Intro-DEFINATION
While creating tables , we may need to apply certain conditions on columns e.g.
, this column must not be blank or NULL for any record. To apply conditions on
columns , SQL constraints are used.
Hence ,
A Constraint is a condition or check applicable on a field or set of fields.
FOR EXAMPLE,
EXPLANATION :-
CREATE TABLE customer
(
Sid int PRIMARY KEY ,
Here,
l_name varchar(10) ,
The column sid is of integer type and its
f_name varchar(10)
value will be UNIQUE as well as NOT
);
NULL and will be uniquely identified in
OR :
the table , because PRIMARY KEY
constraint is applied .
CREATE TABLE customer
(
Sid int ,
l_name varchar(10) ,
f_name varchar(10) ,
PRIMARY KEY (Sid)
);
6.) FOREIGN KEY
FOR EXAMPLE,
EXPLANATION :-