Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can we create clustered index on non primary key column

Answers were Sorted based on User's Feedback



Can we create clustered index on non primary key column..

Answer / ashok

we can creta clustered index on non primary column.
create table abc(eid int,ename varchar(50))
create clustered index abc_clustered on abc (eid)

Is This Answer Correct ?    67 Yes 9 No

Can we create clustered index on non primary key column..

Answer / pavan kumar

YES, We can create a clustered index on a non-primary
column. Check the folowing queries...

CREATE TABLE EMPLOYEES
(
empid int NOT NULL CONSTRAINT ix_pkEMPLOYEES PRIMARY KEY
NONCLUSTERED
, name varchar(25) NOT NULL
, age tinyint NOT NULL
)

CREATE CLUSTERED INDEX ixcEMPLOYEES ON EMPLOYEES (name)

Is This Answer Correct ?    57 Yes 6 No

Can we create clustered index on non primary key column..

Answer / rima

NO.If the table has the primary key column, then by default
it will have a clustered index on that primary key
cloumn.So if you want to create a clustered index on non
primary key column then you have to create it before
setting a column as the primary key column or u have to
delete the clustered Primary key columns index to create a
new one.but it is recommended to have a clustered index on
primary key column.

Is This Answer Correct ?    17 Yes 5 No

Can we create clustered index on non primary key column..

Answer / kaushik ganguly

We know sql server creates a clustered index by default
when we create a primary key. If you create a PK first and
then try to assign a candidate key a clustered index then
it is not possible bcos sql server allows one clustered
index per table.

But...

If you make a candidate key a clustered index and then
define the primary key sql server doesnot create clustered
index for the Primary Key column.

So the answer is yes...you can create a clustered index on
non-pk column :D

Is This Answer Correct ?    11 Yes 2 No

Can we create clustered index on non primary key column..

Answer / surya prakash

Finally, i want to conclude by saying.

1. We can create Clustered Index on Non-Primary Key Columns
and this table should not contain any other column with
Primary Key.

2. It is recommended that we create Clustered Indexing on
Primary Key Columns

Is This Answer Correct ?    9 Yes 3 No

Can we create clustered index on non primary key column..

Answer / sandeep

Yes, We can, only thing is that, we can create clustered
index only on one key.If table contains any clustered index
on any key(even on primary or on unique key) just drop it
and create it on desired key. after it you can create a non
clustered index on primary or on unique key.

Is This Answer Correct ?    4 Yes 0 No

Can we create clustered index on non primary key column..

Answer / vidit

Yes, But on that table primary key should be created with
non-clustered index and the columun u want to create a
cluster index is should be unique

Is This Answer Correct ?    3 Yes 0 No

Can we create clustered index on non primary key column..

Answer / laxman2610

Yes, But on that table primary key should be created with
non-clustered index and the columun u want to create a
cluster index is should be unique

Is This Answer Correct ?    7 Yes 5 No

Can we create clustered index on non primary key column..

Answer / suraj

-- YES.

drop table Employees
create table Employees(
EmpID int Primary Key NonClustered,
[Name] varchar(20),
SSNo varchar(20) )

CREATE CLUSTERED INDEX ci_EMPLOYEES_SS ON EMPLOYEES (Name)

insert Employees values (101,'John','123-45-6789')
insert Employees values (102,'Mike','123-45-6789')


select * from Employees

-- We have to specifically define NonClustered in the
Primary Key column because Clustered Index is created by
default in Primary Key.
-- And, We are able to define Clustered Index in
another column because every table is eligible to have one
clustered index.
-- Clustered Index has to be created after table
creation.
-- From above example, EmpID doesn't take duplicates,
because it is primary key. But, SSNo takes duplicates.

Is This Answer Correct ?    2 Yes 0 No

Can we create clustered index on non primary key column..

Answer / vikas kant

Yes We can create clustered index on a non primary key
column by using the following syntax--:

create clustered index abc_index on Table1(student_class)

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is collation?

0 Answers  


explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

0 Answers  


table:employee EID ENAME MID(manager ids) 101 rama null 102 sita 101 103 siva 101 104 ganesh 103 . . . . . . for 103 ID the manager ID is 101(RAMA) and for 104 manager is SIVA if i give employee id (EID) you have to tell the manager for that EID write query? eample:if i give 102 .The query output should be manager for 102 ID that it should print RAMA as output

7 Answers  


What is SQL Profiler what is the use of it?

2 Answers   247Customer, Steria,


write a query for list of owner who are having multiple bikes in below table 1 shanker pulsar 2 shanker Honda 3 shanker car 4 Balu pulsar 5 Balu Honda 6 Balu car 7 Shyam pulsar 8 Jaya Honda 9 Deepa car 10 vasu car

12 Answers   Cognizant, TCS,


What does asynchronous call backs means?

0 Answers   Alcatel-Lucent,


what is package configuration variable?How to change file name in folder dynamically?Plz help me

1 Answers  


What are the advantages of partitioning?

0 Answers  


How to define and use table alias names in ms sql server?

0 Answers  


What is query optimization process?

0 Answers  


What is the advantage of sql server?

0 Answers  


how do you determine the Load performance of any query in sql server {example how do u determine performance of a select stmnt which returns Dynamically many no of records ... some times 100,1000,10000 etc., }

0 Answers   HCL, Wipro,


Categories