what are the advantages of primary key over unique+notnull
Answers were Sorted based on User's Feedback
Answer / tulsi
Primary key will avoid duplicate and null values in a table
which the combination of unique+not null will do.But the
advantage is,if a table has primary key we can create
relation to child tables.
| Is This Answer Correct ? | 28 Yes | 13 No |
Answer / shilpa.oracle
Primary key accepts only unique values and does not allow
null values.
Unique key accepts unique values and allows null values.
not null constraint allows duplicate values and doesnt allow
null values.
When a primary key constraint or unique key constraint is
created by default index is created on the columns with
these constraints.
| Is This Answer Correct ? | 16 Yes | 4 No |
Answer / smita
A Foriegn key can refer to the primary key.
A Foriegn key can refer to the unique key also .
| Is This Answer Correct ? | 14 Yes | 6 No |
Answer / soubhagya
When we create a primary key automatically a cluster index
is created on those columns involved in primary key.But
this index not created in unique+not null key, it only
restrict the duplicate values.
| Is This Answer Correct ? | 4 Yes | 3 No |
Answer / kamal
we are able to create a primary key for combination of more
than 1 column. which is not possible in Unique,we should
create unique key for each and every column in the table
individually.
ex . we can create a primary key for (Name,DOB,address)- ie
combination of these three columns be unique.
| Is This Answer Correct ? | 3 Yes | 5 No |
Answer / charumathi
Unique-Duplicates not allowed
Nulls allowed
Not null-NUlls not allowed
Primary key-No Duplicates
No Nulls
A Foriegn key can refer to the primary key.
| Is This Answer Correct ? | 4 Yes | 7 No |
Answer / nitesh
PRIMARY KEY CREATED WITH INDEXES WHICH IS NOT HAPPEN WITH
UNIQUE AND NOT NULL
| Is This Answer Correct ? | 8 Yes | 21 No |
Let us suppose we have a table with structure in order empno empname empdesig empcountry and now i want to re-organize the columns of this table to empno empdesig empname empcountry how can i do this with queries ? assume that table contains the data.
there is A table and B table in A table there 5 rows and in b table there are 2 rows i am firing query select * from a,b what will be the output?
How can we implement rollback or commit statement in a trigger?
Why do we use procedures in pl sql?
Explain commit, rollback and savepoint.
What is rowtype?
Explain the difference between triggers and constraints?
What is cascade in sql?
What is a boolean in sql?
explain the difference between delete , truncate and drop commands? : Sql dba
What is informix sql?
What is t sql used for?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)