IN A TABLE HAVE ONE COLUMN PRIMARY KEY..IT WILL NOT ALLOWS
NULL VALUES AND DUPLICATE VALUES..INSTEAD OF PRIMARY KEY
WHY CANT WE USE UNIQUE AND NOT NULL.THESE TWO ALSO DOESNT
ACCEPT NULL VALUES IN NOT NULL AND UNIQUE DOESNT ACCEPT
DUPLICATE VALUES?
SO WHAT IS THE DIFEERENCE BETWEEN(UNIQUE,NOT NULL) AND
PRIMARY KEY??????

Answer Posted / joshy joy

1. Primary key creates Clustered Indexes and they are physically sort the data.
2. Oracle server automatically creates and maintains an index on the primary key and because of that searching will be very fast on that table.
3. Primary can be used for referential integrity when dealing with foreign key in child table

1. Unique can have only Non-clustered indexes, where data are not physically sorted.
2. unique key + not null will not create any index on that column(s)
3. Key column should be Primary key column in parent table when when dealing with foreign key

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does where 1 1 mean in sql?

643


What are the different types of dbmss?

648


What is trigger and types?

670


Explain the types of joins in sql?

651


What is compiled query?

639






What is a relationship and what are they?

681


How do you create a unique index?

663


Which is faster subquery or join?

767


In pl/sql, what is bulk binding, and when/how would it help performance?

629


Why are cursors used?

680


What is the difference between rollback and rollback to statements?

687


How to return multiple rows from the stored procedure?

621


Why use triggers in sql?

602


What is a temporal data type?

679


What are the events on which a database trigger can be based?

707