The UNIQUE constraint uniquely identifies each record in a database table. There can be many UNIQUE constraints per table.
A Unique key column can contain NULL values.
Syntax :-
CREATE TABLE student
(
Name varchar (30),
Roll integer (5),
Mobile_no integer (10) UNIQUE KEY
);
Example :-
CREATE TABLE u_tab
(
stu_id int (5) UNIQUE KEY,
name varchar (30),
roll int (5) UNIQUE KEY,
city varchar (40)
);
Insert Table :-
A Unique key column can contain NULL values.
Syntax :-
CREATE TABLE student
(
Name varchar (30),
Roll integer (5),
Mobile_no integer (10) UNIQUE KEY
);
Example :-
CREATE TABLE u_tab
(
stu_id int (5) UNIQUE KEY,
name varchar (30),
roll int (5) UNIQUE KEY,
city varchar (40)
);
Insert Table :-
0 Comments:
Post a Comment