IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

comparasion


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Biswajit Nanda

New User


Joined: 28 Mar 2011
Posts: 9
Location: India

PostPosted: Tue May 17, 2011 12:10 pm
Reply with quote

IS UNINON = OUTER jOIN?
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue May 17, 2011 2:05 pm
Reply with quote

no, although some idiots use full outer join when a union is required.
Back to top
View user's profile Send private message
Biswajit Nanda

New User


Joined: 28 Mar 2011
Posts: 9
Location: India

PostPosted: Tue May 17, 2011 2:08 pm
Reply with quote

Please,can you give me details, why its different?
Back to top
View user's profile Send private message
mallik_0279

New User


Joined: 13 Aug 2007
Posts: 4
Location: hyderabad

PostPosted: Tue May 17, 2011 2:12 pm
Reply with quote

hello,

pls post your question clearly..
so that members can help you
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue May 17, 2011 2:22 pm
Reply with quote

As GuyC said "No" -- to take it further, in a join, the matching rows are joined side-by-side to make the result table. By contrast, in a union the matching rows are joined (in a sense) one-above-the-other to make the result table.

Hope you've the answer?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 17, 2011 2:26 pm
Reply with quote

I like to think the UNION along the lines of a <datatset> CONCATENATION
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Tue May 17, 2011 2:26 pm
Reply with quote

The output record set in union contains same number of columns as in the input tables. But it concatenates all the records of both the input tables in the output. Both the input tables should have the same number of columns and same data types for those columns.

But the full outer join concatenates the columns in both the table. No need for the input tables to have same number of records.
a full outer join combines the results of both left and right outer joins. The joined table will contain all records from both tables, and fill in nulls for missing matches on either side
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue May 17, 2011 2:56 pm
Reply with quote

gylbharat wrote:
The output record set in union contains same number of columns as in the input tables. But it concatenates all the records of both the input tables in the output. Both the input tables should have the same number of columns and same data types for those columns.

But the full outer join concatenates the columns in both the table. No need for the input tables to have same number of records.
a full outer join combines the results of both left and right outer joins. The joined table will contain all records from both tables, and fill in nulls for missing matches on either side

close, but no cigar.
- The tables in a union don't have to have the same number of columns or "records". The selects in a union must specify the same number and compatible types of columns!
a union will show duplicate rows only once, a union all will show duplicate rows if they exist.
in enrico-sorichetti words :
a union is like concatenate datasets and a sort sumfields=none
a union all is like concatenate datasets

- a full outer join will contain all rows from both tables, but depending on your join condition, the same row can be reported multiple times.
in enrico-sorichetti words : a full outer join is like a 2 datasets merge program.

So functionally different things.
Sure you can do a union using a full outer join and a lot of coding.
Sure you can do a full outer join using a union and a lot of coding.
But that is just stupid.
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Tue May 17, 2011 2:56 pm
Reply with quote

The answer is "It is not".
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue May 17, 2011 3:15 pm
Reply with quote

removed by poster.
no need to duplicate guyc's response,
other to add:

and db2 tables do not have records, they have rows.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts comparasion between BIN FIXED(63) an... PL/I & Assembler 10
No new posts Comparasion of files with different cond DFSORT/ICETOOL 1
Search our Forums:

Back to Top