GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL

 Print  |  
Question:  What is difference between UNIQUE and PRIMARY KEY constraints?


Answer:
A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PK are automatically define NOT NULL, whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also specify the column is NOT NULL.


August 08, 2007 04:50:14 #7
 velsowmya   Member Since: August 2007    Total Comments: 7 

RE: What is difference between UNIQUE and PRIMARY KEY ...
 
Primary key wont accept null values and a table can have only one primary key for a column.
Unique key accepts null values.A table can have any number of unique keys.
     

 

Back To Question