Difference between primary key and unique key ?

Answer Posted / madhumita majhi

In SQL both primary key and unique enforce uniqueness of
the column on which they are defined. But by default
primary key creates a clustered index on the column, where
are unique creates a non-clustered index by default.
Another major difference is that, primary key doesn't allow
NULLs, but unique key allows one NULL only.

Unique Key: Identify the row by uniquely, means if you are
inserting a records into the table suppose you already
inserted a record with ID 101 and another record you are
inserting with the same ID then it will give an error
(unique key voilation).

Prmary Key:Once you define a primay key on a particular
column then a column become a mandatory field.That means
you need to insert something on it, you can not leave as a
blank otherwise it will give an error as primary key
voilation.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I am using an Oracle 8i Database my data contains Clob data. I am using toad version 7.6 i am able to get the data in toad but unable to extract the data in excel.when trying to extract the data into the excel the toad error says out of memory. Can any body please help me to extract the data through the same toad version. Thanks in advance

1857


What are the limitations oracle database 10g xe?

578


How do I escape a reserved word in oracle?

639


How to pass a parameter to a cursor in oracle?

604


How to export data to a csv file?

632






How to connect the oracle server as sysdba?

640


What is tns service name?

631


Can group functions be mixed with non-group selection fields?

542


Explain how you would restore a database using RMAN to Point in Time?

1645


How to export your connection information to a file?

603


What is meant by a deadlock situation?

584


What do you mean by group by clause?

567


How to resolve name conflicts between variables and columns?

579


Explain the use of indexes option in exp command.

599


What is the difference between substr and instr?

529