What is the difference between UNIQUE CONSTRAINT and
PRIMARY KEY?
1. There is no difference.
2. A PRIMARY KEY cannot be declared on multiple columns.
3. A UNIQUE CONSTRAINT cannot be declared on multiple
columns.
4. A table can have multiple PRIMARY KEYS but only one
UNIQUE CONSTRAINT.
5. A table can have multiple UNIQUE CONSTRAINTs but only
one PRIMARY KEY.
Answer Posted / vikneswaran
1) primary key don't allow null values but unique const
allow null values
2)we can declare primary key as multiple column. but table
should have one primary key
3)we can declare unique as multiple column. but table should
have one unique key
4) and 5)
in table we can create multiple column of primary key and
multiple column of unique. but only the restriction is in
table should have one primary key and one unique key .. if
it is neccessary.
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Explain how to use transactions efficiently : transact sql
Why do we use view in sql?
How do you add a column to a table?
GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?
What is foreign key in sql with example?
What are the conditions an underlying table must satisfy before a cursor can be used by a positioned update or delete statement? : Transact sql
What are all the common sql functions?
What is pivot query?
What is rowtype?
Why we use stored procedure instead of query?
What are sql functions? Describe in brief different types of sql functions?
What is a temp table?
Can we use the cursor's to create the collection in PL/SQL?
How to use transactions efficiently : transact sql
what is a materialized view? : Sql dba