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                      
tip   SiteMap shows list of All Categories in this site.
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
Can we create a clustered index on composite primary key.
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Can we create a clustered index on composite primary key.
Answer
# 1
Here's the procedure: 

Create a table with no primary key defined. 
Create clustered index on the primary key columns. 
Alter the table to define the primary key.

Table creation: 

 create table CDSWEB.Anil (officeid integer not null,
 empid integer not null,
 age integer ,sex varchar(5),
 name varchar(20));

Index creation: 
 create index CDSWEB.AN001 on CDSWEB.Anil(officeid,empid)
 CLUSTER;

Primary key defined: 
 
alter table CDSWEB.ANIL
add primary key (officeid,empid);
 
Is This Answer Correct ?    1 Yes 0 No
Anil Kumar
 
  Re: Can we create a clustered index on composite primary key.
Answer
# 2
You can also do this.

create table Test
(officeid integer not null,
 empid integer not null,
 age integer ,
 sex varchar(5),
 name varchar(20),
PRIMARY KEY (OFFICEID, EMPID))


this will also create composite primary key and cluster 
index on composite primary key.
 
Is This Answer Correct ?    5 Yes 0 No
Monal
 
 
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What is a Stored Procedure?  7
Wht is SQL Injection Attack ?  1
What is the role that is required for killing a process What is the role that is required for creating a linked server IBM1
what is meant by deafult in sql server?  2
if we have a column (Key) in a table. and values of that column is Key 1 1 1 2 2 3 3 4 4 5 5 5 and we want to show the data after query..like.. 1(3) 2(3) 3(2) 4(2) 5(3) how many times a single term comes.. Rolta5
What do you mean by COLLATION?  4
Is it possible to delete duplicate rows in a table without using a temporary table ?  6
How can your resolve deadlocks? IBM3
What is an execution plan? When would you use it? How would you view the execution plan?  1
There is a trigger defined for INSERT operations on a table, in an OLTP system. The trigger is written to instantiate a COM object and pass the newly insterted rows to it for some custom processing. What do you think of this implementation? Can this be implemented better? HCL1
1.what is the difference between view and cursor? 2.If we do any change in view will it affect the database,similarly when we do changes in cursor will it affect the databse?with certain example?Thanks  3
What are sub-queries? Give example? In which case sub-queries are not feasible? Infosys3
What is the appropriate number of test cases that you can write on a database? Microsoft1
What is the basic functions for master, msdb, tempdb databases? CSC2
explain different types of jions with examples briefly? Zensar3
Can I know,how to Execute Funcion and Trigger through command(Manualy Execution) in MS SQL/SERVER 2005,give me answer with Example.  1
Difference between Cluster and Non-cluster index? Oracle9
What are SQL Jobs, please mention the use of it and how to create them. 247Customer1
PC(code, model, speed, ram, hd, cd, price) Find the hard drive sizes that are equal among two or more PCs. APX2
What command do we use to rename a db?  3
 
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