Can we create clustered index on non primary key column

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is replication and database mirroring?

789


what authentication modes does sql server support? : Sql server database administration

714


What is an index in sql?

726


What is sql profiler. What are the default templates with it? : sql server database administration

691


What happens if ntwdblib.dll is missing on your machine?

863






Describe the left outer join & right outer join. : sql server database administration

752


Explain about link server in sql server?

736


What is checkpoint process in the sql server?

708


What is store procedure?

819


How to provide column names in insert statements in ms sql server?

807


when you create a database how is it stored? : Sql server database administration

677


you have separate development and production systems you want to move a copy of a development database into production to do this, you do a backup on the development system and restore to the production system after a few minutes, you begin getting calls from several customers saying that they are denied access to the system why? : Sql server administration

715


Does sql server use java?

727


What are the differences between ms sql server & oracle?

740


What is sleeping status in sql server?

704