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
Explain mutating triggers.
I creat Credit memo in AR. Now i want revers the Credit Memo.how you can revers that what out any aditional entry.
What does sharding mean?
How to create a table in a specific tablespace?
Explain the use of show option in imp command.
List out the difference between commit, rollback, and savepoint?
What is a data lock in oracle?
How many file formats are supported to export data?
How to define a variable to match a table column data type?
How to set a transaction to be read only in oracle?
Explain the use of parfile option in exp command.
What are group functions in oracle?
In which language oracle has been developed?
what is difference between sql plus and sql*plus? (not sql and sql plus).
How do I spool in oracle?