Salim berbagi…. tempat belajar dan berinteraksi….


Union & Union All
May 19, 2010, 12:42 AM
Filed under: ORACLE, Sistem Informasi

UNION is a SQL set operation that returns all rows from two different select statements, and then eliminates any duplicate rows from the result set.

For example, the below query will return all rows from table_A and table_B (no duplicates):

SELECT * FROM table_A
UNION
SELECT * FROM table_B;

UNION ALL is a SQL set operation that returns all rows from two different select statements. Unlike with Union, duplicate rows are NOT removed from the result set. As a result, UNION ALL is faster than a UNION.

For example, the below query will return all rows from table_A and table_B (may contain duplicate rows):

SELECT * FROM table_A
UNION ALL
SELECT * FROM table_B;

Leave a Comment so far
Leave a comment



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: