How are the OUTER JOIN operations different from the INNER JOIN operations? How is the OUTER UNION operation different from UNION?

Short Answer

Expert verified
INNER JOIN only returns matched records from the tables, while OUTER JOIN returns all the records from one table and matched records from the other. In case of no match, OUTER JOIN returns NULL for every column of the table without a match. UNION operation combines the result-set of the select statements that have the same number of columns, similar data types, and same order while removing duplicates. OUTER UNION, however, returns all records from the tables including unmatched records and does not remove duplicates.

Step by step solution

01

Understanding INNER JOIN

The INNER JOIN operation returns only the matched records from two tables. Suppose there are two tables, Table A and Table B, when an INNER JOIN operation is performed on these tables, it will return only the records that have matching values in both tables.
02

Understanding OUTER JOIN

An OUTER JOIN operation, on the other hand, returns all the records from one table (Table A or Table B) and the matched records from the other table. If there is no match, it will result in NULL values for every column of the table that does not have a matching record.
03

Differences between INNER and OUTER JOIN

The main difference between INNER JOIN and OUTER JOIN lies in the way they handle the non-matching records: INNER JOIN disregards them while OUTER JOIN includes them.
04

Understanding UNION operation

The UNION operation is used to combine the result-set of two or more SELECT statements. However, for UNION to work, each SELECT statement within the UNION must have the same number of columns, the columns must also have similar data types, and they must also be in the same order.
05

Understanding OUTER UNION operation

The OUTER UNION operator concatenates the tuples of the participating relations, even if they do not match. If some tuples have no match or counterpart in the other relation, NULL values are used for the missing columns.
06

Differences between UNION and OUTER UNION

UNION only returns the matched records from the participating tables, eliminating the duplicate values. OUTER UNION, however, returns all the records, including the unmatched records, from the tables and does not eliminate duplicate values.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free