Primary key:
uniquely identified each row in Table is called primary key. One table can have more then one primary key, primary key can not allow null values and duplicate value. it is default cluster indexes.
Unique key:
uniquely identified each row in Table is called uniquely key.Unique key does not allow duplicate values.Unique key allows only one null value in a column of table in which you have define unique key constraint.
I have created Student Table as shown below,
CREATE TABLE student (
id INT not null ,
fullName VARCHAR(100) NOT NULL,
gender CHAR(1)
)
Insert some records into student table.
INSERT INTO student VALUES(1,'aamir hasan','M')
INSERT INTO student VALUES(1,'aamir hasan','M')
select * from Student
DELETE FROM student
Define a primary key constraint on id field
ALTER TABLE student ADD CONSTRAINT pkstudent PRIMARY KEY (id)
Insert some records into student table.
INSERT INTO student VALUES(1,'aamir hasan','M')
INSERT INTO student VALUES(1,'aamir hasan','M')

DELETE FROM student
Add Unique Key contraint on fullname
ALTER TABLE student ADD CONSTRAINT IX_Name UNIQUE(fullName)
INSERT INTO student VALUES(1,null,'M')
INSERT INTO student VALUES(1,'null','M')
INSERT INTO student VALUES(1,'aamir hasan','M')
INSERT INTO student VALUES(1,'aamir hasan','M')
SELECT * FROM student
[adsense aamirhasan text one]