View previous topic :: View next topic |
Author |
Message |
shalini Beginner
Joined: 17 Jun 2005 Posts: 4 Topics: 3 Location: bangalore
|
Posted: Wed Jun 22, 2005 5:47 am Post subject: Two primary keys can share an Index |
|
|
Can two primary keys can share the same index or not. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
|
Posted: Wed Jun 22, 2005 7:55 am Post subject: |
|
|
Shalini,
I am not sure as to what you mean by two primary keys as A table can have only one primary key, and the columns of a primary key cannot contain null values.
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
shalini Beginner
Joined: 17 Jun 2005 Posts: 4 Topics: 3 Location: bangalore
|
Posted: Fri Jun 24, 2005 9:43 am Post subject: |
|
|
hi kolusu
i mean to say composite key
create table t1 (empid int not null,ename char(10),eno int not null
composite key(empid,eno)) ;
The structure of the table is in above format , is one index is enough for two keys. _________________ hello, i am a student ... currently prusing the
mainframe course in the institute |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12384 Topics: 75 Location: San Jose
|
Posted: Fri Jun 24, 2005 10:06 am Post subject: |
|
|
Shalini,
An INDEX can have more than one column.
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
schintala Beginner
Joined: 18 May 2005 Posts: 108 Topics: 31 Location: USA
|
Posted: Fri Jun 24, 2005 1:29 pm Post subject: |
|
|
Hi,
Since your table had composite key that means you already an index combination of those columns. Additionally you can have indiviual indexes on each of these columns that depends on your application. But it it not a good idea to have more indexes as it consumes lot of disk space and your query performace will be slower for any insert or undate functions. |
|
Back to top |
|
 |
|
|