Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Why JOIN is more advantageous than UNION

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sudhakar.harish
Warnings : 1

New User


Joined: 06 Dec 2006
Posts: 3
Location: ERNAKULAM

PostPosted: Wed Dec 06, 2006 10:53 pm    Post subject: Why JOIN is more advantageous than UNION
Reply with quote

May i know why join is more advantageous than union
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Fri Dec 08, 2006 12:56 am    Post subject: Re: Union and join
Reply with quote

Harish,

Join and Union cannot be compared as one is more advantageous than the other. The serve different functions.

Think of the union and join as concatenations.

A ?Union? concatenates ?rows? together and must have the same structure. So if you ?union? 2 tables together that have the same structure. Say both have 25 columns (need to match definition), one has 1000 rows and the other 2500 rows, the union will result in 3500 rows, or less depending upon if you use ?union all? or not.

A ?join? concatenates ?columns? together from multiple tables. So if you join 2 tables together, one with 25 columns and one with 50 columns, the resultant row will have 75 columns. Please read up on inner and outer joins for rules on how the joins work.

Dave
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
No new posts How can we have the varying lenth of ... Gunapala CN DFSORT/ICETOOL 6 Fri Oct 14, 2016 7:31 pm
No new posts Join key - Populate Zeros when Unpair... rexx77 DFSORT/ICETOOL 6 Thu May 12, 2016 12:22 am
No new posts Join Keys and DB2 Query jackare SYNCSORT 2 Sat Feb 13, 2016 5:57 am
No new posts Join Keys to compare two files senthamizh DFSORT/ICETOOL 2 Fri Feb 05, 2016 8:28 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us