Tuesday, February 21, 2012

what is unique key in mysql

  1. unique  is key and its always unique,    that means no repeat  ,
  2. unique is just like primary key but unique  may be NULL and primary key is not NULL

how to create unique key in mysql table

CREATE TABLE  tablename
(
id  int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
UNIQUE (id)
)



how to create unique key in mysql with multiple columns


create unique key with combination of multiple column


alter table tbName add unique index(column1column2column3,.....)

No comments:

Post a Comment

If you Satisfied , Please Leave a comment