nerdexam
CompTIA

DA0-001 · Question #197

An analyst needs to join two tables of data together for analysis. All the names and cities in the first table should be joined with the corresponding ages in the second table, if applicable. Table…

The correct answer is B. LEFT JOIN, four rows. A LEFT JOIN returns all rows from the left table (Table 1) regardless of whether a match exists in the right table (Table 2), with NULL filling in where no match is found. The phrase 'if applicable' signals that not all names will have a matching age - exactly what a LEFT JOIN…

Data Analysis

Question

An analyst needs to join two tables of data together for analysis. All the names and cities in the first table should be joined with the corresponding ages in the second table, if applicable. Table 1 Table 2 Which of the following is the correct join the analyst should complete, and how many total rows will be in one table?

Options

  • AINNER JOIN, two rows
  • BLEFT JOIN, four rows
  • CRIGHT JOIN, five rows
  • DOUTER JOIN, seven rows

How the community answered

(52 responses)
  • A
    15% (8)
  • B
    73% (38)
  • C
    4% (2)
  • D
    8% (4)

Explanation

A LEFT JOIN returns all rows from the left table (Table 1) regardless of whether a match exists in the right table (Table 2), with NULL filling in where no match is found. The phrase 'if applicable' signals that not all names will have a matching age - exactly what a LEFT JOIN handles. If Table 1 has 4 rows, the result will have 4 rows: matched rows get their age populated, unmatched rows show NULL for age. An INNER JOIN would drop unmatched rows, a RIGHT JOIN would prioritize Table 2, and an OUTER JOIN would include all rows from both tables potentially inflating the count.

Topics

#SQL Joins#LEFT JOIN#Data Manipulation#Relational Databases

Community Discussion

No community discussion yet for this question.

Full DA0-001 Practice