DA0-002 practice question 21 of 25

[Data Concepts and Environments]A data analyst is creating a new dataset that involves bringing together the following datasets: Name ID Date of…

Full set: 111 questions

[Data Concepts and Environments]

A data analyst is creating a new dataset that involves bringing together the following datasets: Name ID Date of birth Frank 23525 3/19 Martha 11290 6/13 Ellen 12141 11/4 ID Address City State 23525 1234 Harding Chicago IL 11040 935 Terrace Hills Chino CA 11290 2 Speedway Miami FL Which of the following would be the output if the data analyst does a FULL JOIN?

Answer options
A: NameIDDate of birthAddressCityStateFrank235253/191234 HardingChicagoILMartha112906/13935 Terrace HillsChinoCAEllen1214111/42 SpeedwayMiamiFL
B: NameIDDate of birthAddressCityStateFrank235253/191234 HardingChicagoILMartha112906/13935 Terrace HillsChinoCAEllen1214111/42 SpeedwayMiamiFL
C: NameIDDate of birthAddressCityStateFrank235253/191234 HardingChicagoILMartha112906/132 SpeedwayMiamiFLEllen1214111/4935 Terrace HillsChinoCA
D: NameIDDate of birthAddressCityStateFrank235253/191234 HardingChicagoILMartha112906/132 SpeedwayMiamiFLEllen1214111/411040935 Terrace HillsChinoCA Correct answer
Correct Answer:
D. NameIDDate of birthAddressCityStateFrank235253/191234 HardingChicagoILMartha112906/132 SpeedwayMiamiFLEllen1214111/411040935 Terrace HillsChinoCA
Explanation

A FULL OUTER JOIN (or FULL JOIN) returns all records from both tables, matching them where possible based on the join key (ID). When a match is found (for IDs 23525 and 11290), the rows are combined. When a record exists in one table but not the other, it is still included in the result, and the columns from the missing table are filled with NULL values. Therefore, Ellen's record (ID 12141) is included with NULL for address information, and the address record for ID 11040 is included with NULL for name and date of birth. Option D correctly represents this complete set of matched and unmatched records.

Why Incorrect

A. This option incorrectly matches rows by their position instead of the ID key and omits the unmatched address record (ID 11040).
B. This option is identical to option A and is incorrect for the same reasons.
C. This option incorrectly joins Ellen's record with an unrelated address and omits the unmatched address record (ID 11040) entirely.

References

1. Silberschatz

A.

Korth

H. F.

& Sudarshan

S. (2020). Database System Concepts (7th ed.). McGraw-Hill. In Chapter 4

"Intermediate SQL

" the section on Outer Join Operations describes the full outer join as a combination of left and right outer joins that preserves all tuples from both relations

filling in NULL values for non-matching attributes.

2. PostgreSQL. (2023). PostgreSQL 16 Documentation

Section 7.2.2. Join Types. The documentation states

"FULL OUTER JOIN returns all rows from both joined tables. For rows that do not have a matching row in the other table

the columns of the other table will have null values."

3. Stanford University. (n.d.). CS 145: Introduction to Databases

Lecture Notes: SQL 2. Retrieved from https://web.stanford.edu/class/cs145/notes/SQL-2.pdf. The notes define FULL OUTER JOIN as returning all tuples from both relations

padding with NULLs where no match is found in the other relation.

Scroll to Top