ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
What's the difference between a primary key and a unique key?
 Question Submitted By :: Srinivas
I also faced this Question!!     Rank Answer Posted By  
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 1
In primary key  not allowed any null value while in unique 
key one null value allowed.
 
Is This Answer Correct ?    8 Yes 0 No
Raj
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 2
By default Primary Key Create Cluster index while unique 
ker create non cluster index
 
Is This Answer Correct ?    4 Yes 1 No
Awdhesh
 
 
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 3
only 1 p.K. have per table

u can have multipale Unique key per table
 
Is This Answer Correct ?    7 Yes 2 No
Sachin Patil
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 4
Primary key is a combination of unique+not null+cluster 
index and it will not allow any duplicate values, null 
values, and it's data will be arranged in ascending order 
due to clustered index.  Only one primary key is allowed 
per table.

Unique key is a key which will not accept any duplicate 
values, but it will accept one null value.  We can place 
any number of unique keys per table.
 
Is This Answer Correct ?    9 Yes 0 No
Srinivas
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 5
PRIMARY KEY AND UNIQUE KEY

   * Both Enforces Uniqueness
   * Primary key  Creates clustered index
     unique key creates non clustered index 
   * primay key does not allows null value
     unique key allows 1 null value
 
Is This Answer Correct ?    3 Yes 0 No
Karthick
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 6
The difference is primary key does not allow any one null 
value,but unique allow only one null value,because it 
consider null as one value
 
Is This Answer Correct ?    2 Yes 0 No
Karthikumar
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 7
There are difference between Primary key and unique key.

1. Primary key allow not null value where as unique key 
allow only one null value.

2. Primary key  Creates clustered index where as unique key 
creates non clustered index.
 
3. Primary key is only one in a table where as unique key 
is multiple in a table.

4. Primary key is not accept duplicate value where as 
Unique key is also not accept any duplicate values, but it 
will accept one null value.
 
Is This Answer Correct ?    2 Yes 1 No
Mrityunjay Kumar
 
  Re: What's the difference between a primary key and a unique key?
Answer
# 8
HI ALL

IN CASE OF INSERTING REPETED NULL IN UNIQUE KEY COLOUMN ,
IF IT IS COMPOSITE KEY IS POSSIBLE. . . ANY LOGICAL RESON?

Eg:
CREATE TABLE TRY(ROLL NUMBER,LIB_CARD_NO NUMBER,
               CONSTRAINT CON_UNQ UNIQUE(ROLL,LIB_CARD_NO));

INSERT INTO TRY VALUES(NULL,NULL); 
--> 1 ROW CREATED
INSERT INTO TRY VALUES(NULL,NULL); 
--> 1 ROW CREATED -- REPETED NULL ARE ALLOWED!!!!
 
Is This Answer Correct ?    0 Yes 0 No
Sunil
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
How can I create a plain-text flat file from SQL Server as input to another application?  2
How do you fine the performance tunning? Accenture2
How to Display, Amount of Disk Activity Generated by Transact-SQL Statements?  1
Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?  2
How To Change Column Ordinal Position in SQL Server 2005 using Query i.e I Want To Add Column at Particular Ordinal Position in SQL Server 2005  2
What are the all different types of Joins in SQL Server 2000, Anybody can explain each join with definition..Thanks in advance.... Siemens6
How to Get the last identity value used  4
plz send every query in sql server2000 Infosys1
What is bit datatype and what's the information that can be stored inside a bit column?  1
When you first load SQL SERVER you will startup with what all databases? CompuSol3
how to know Who Is Blocking Your SQL Server?  3
What is the difference between login and a user? TCS7
If you are working on a SQL database and if suddenly a developer changes the code and your queries results start giving errors,how will you check using a T-SQL query (on system tables) that what has changed in the database. Microsoft2
What is The Use Of TIMESTAMP DataType in SQL Server 2005?  3
create procedure proc1 (@a int) as begin if @a=1 create table #temp(a1 int) else create table #temp(a1 int) end while executeing the above code it shows error like '#temp already exist' .why it shows an error? IBM5
i have 4 tables.. T1, T2, T3, T4.. these tables have the same structure and they store the information entered in different years.. T1 stored 2002, T2 stored 2003, T3 stored 2004 and T4 stored 2005.. i want to copy contents in T1 to T2, T2 to T3, T3 to T4 and T4 to T1.. how do i do that? Temp tables cannot be used..  2
What is the difference between a local and a global variable?  3
Alternative way to DetDate() function?  4
What is referential integrity? What are the advantages of it? Digital-Domain3
how do we find every fifth record in a table  11
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com