If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > can i join all the 200 tables? (was "DB2")

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-11-07, 07:03
charles18 charles18 is offline
Registered User
 
Join Date: Nov 2007
Posts: 4
can i join all the 200 tables? (was "DB2")

In one tableset i have 200 tables .can i join all the 200 tables or can join all the tables inside the tableset

how can i find the unique variable to join
Reply With Quote
  #2 (permalink)  
Old 12-11-07, 07:43
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Can you give an example of what you are trying to achieve?
Are you asking suggestions for denormalizing data or are you asking about SQL ?


Also, give more details about DB2 you are using - version, fixpak, operating system etc.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 12-11-07, 09:35
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by charles18
In one tableset i have 200 tables.
can i join all the 200 tables or can I join all the tables inside the tableset?

how can i find the unique variable to join?
If you are referring to NATURAL JOIN: no, DB2 does not support "automatic" selection of join columns. The concept of natural join is generally considered "dangerous" and "better not used".
Back to DB2: you will have to spell out all 200 table names, and also all (at least) 199 join conditions.

Apart from that, joins of up to 225 tables are possible (at least, with DB2 on z/OS from version 8 on).
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #4 (permalink)  
Old 12-12-07, 04:06
charles18 charles18 is offline
Registered User
 
Join Date: Nov 2007
Posts: 4
db2

let me brief out requirement . I am developing one tool in rexx . for that i am displaying all the tables from the tablespace to the user so that user selects few tables .so i need to join the selected tables (i.e join query have to executed ).i need to know the variable which will be used to join .In db2 .all the tables inside a tablespace will have relations between them right .how to retreive that
Reply With Quote
  #5 (permalink)  
Old 12-12-07, 05:18
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
You can retrieve relationship between tables using SYSIBM.SQLFOREIGNKEYS procedure or by using the catalog tables (owner SYSIBM)

But, your assumption that the tables will have a relationship between them is not correct. There may be tables that do not have any relationship between them. Even, if a relationship actually exists (ie, business rule), they may not be defined in the database.



Quote:
Originally Posted by charles18
let me brief out requirement . I am developing one tool in rexx . for that i am displaying all the tables from the tablespace to the user so that user selects few tables .so i need to join the selected tables (i.e join query have to executed ).i need to know the variable which will be used to join .In db2 .all the tables inside a tablespace will have relations between them right .how to retreive that
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On