MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Two primary keys can share an Index

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
shalini
Beginner


Joined: 17 Jun 2005
Posts: 4
Topics: 3
Location: bangalore

PostPosted: Wed Jun 22, 2005 5:47 am    Post subject: Two primary keys can share an Index Reply with quote

Can two primary keys can share the same index or not.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12384
Topics: 75
Location: San Jose

PostPosted: Wed Jun 22, 2005 7:55 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
shalini
Beginner


Joined: 17 Jun 2005
Posts: 4
Topics: 3
Location: bangalore

PostPosted: Fri Jun 24, 2005 9:43 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12384
Topics: 75
Location: San Jose

PostPosted: Fri Jun 24, 2005 10:06 am    Post subject: Reply with quote

Shalini,

An INDEX can have more than one column.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
schintala
Beginner


Joined: 18 May 2005
Posts: 108
Topics: 31
Location: USA

PostPosted: Fri Jun 24, 2005 1:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group