アナリストは、分析のために 2 つのデータ テーブルを結合する必要があります。該当する場合は、最初の表のすべての名前と都市を 2 番目の表の対応する年齢と結合する必要があります。

アナリストが完了する必要がある正しい結合は次のうちどれですか。1 つのテーブルには合計行数は何行になりますか?
正解:B
The correct join the analyst should complete is B. LEFT JOIN, four rows.
A LEFT JOIN is a type of SQL join that returns all the rows from the left table, and the matched rows from the right table. If there is no match, the right table will have null values. A LEFT JOIN is useful when we want to preserve the data from the left table, even if there is no corresponding data in the right table1 Using the example tables, a LEFT JOIN query would look like this:
SELECT t1.Name, t1.City, t2.Age FROM Table1 t1 LEFT JOIN Table2 t2 ON t1.Name = t2.Name; The result of this query would be:
Name City Age Jane Smith Detroit NULL John Smith Dallas 34 Candace Johnson Atlanta 45 Kyle Jacobs Chicago 39 As you can see, the query returns four rows, one for each name in Table1. The name John Smith appears twice in Table2, but only one of them is matched with the name in Table1. The name Jane Smith does not appear in Table2, so the age column has a null value for that row.