Certified Data Engineer Associate Exam QuestionsBrowse all questions from this exam

Certified Data Engineer Associate Exam - Question 68


A data engineer is working with two tables. Each of these tables is displayed below in its entirety.

The data engineer runs the following query to join these tables together:

Which of the following will be returned by the above query?

Show Answer
Correct Answer: CD

The query uses a LEFT JOIN, which returns all records from the left table (sales) and the matching records from the right table (favorite_stores). If there are no matches, NULL is returned for columns from the right table. In this case, customer_id 'a3' in the sales table does not have a corresponding entry in the favorite_stores table, so its store_id will be NULL. The resulting joined table will include all records from the sales table, with matching store_id from the favorite_stores table where available. Therefore, the correct result will display customer_ids 'a1', 'a3', and 'a4', with 'a3' having store_id as NULL.

Discussion

12 comments
Sign in to comment
kz_dataOption: C
Dec 6, 2023

C is correct

[Removed]Option: C
Oct 20, 2023

The LEFT JOIN keyword returns all records from the left table, even if there are no matches in the right table.

55f31c8Option: C
Nov 29, 2023

The LEFT JOIN keyword returns all records from the left table (table1), and the matching records from the right table (table2). The result is 0 records from the right side, if there is no match.

nedloOption: C
Dec 5, 2023

C is correct answer

anandpsg101Option: C
Oct 25, 2023

c is corret

HuroyeOption: C
Nov 15, 2023

The answer is C. this is a Left Join. In this case you show everything on the left side regardless of whether they appear on the right. When it does not appear on the right you represent that with a Null. So, for a3, store id is null.

Blacknight99Option: C
Nov 21, 2023

C is the correct answer

potaryxkugOption: C
Jun 21, 2024

C is correct

kishanuOption: C
Oct 20, 2023

A typical LEFT JOIN scenario

meow_akkOption: C
Oct 22, 2023

Ans C: Left join only keeps left recs and only the matching recs from Right table. in other words : the left table is preserved as is.

mokraniOption: C
Nov 7, 2023

C is correct. please refer to this simple blog if any confusion regarding JOINS https://sql.sh/cours/jointures

dev_soumya369Option: C
Nov 10, 2023

C is the correct answer. In a LEFT JOIN, all the records from the left table are included, and only the matching records from the right table are added. In this case, "a1" and "a4" from the left table (favorite_stores) match with "a1" and "a4" from the right table (sales). So, these matching records are fetched. Additionally, all the records from the left table, including "a3," are included. Since "a3" has no corresponding store_id in the right table, the store_id for "a3" will be NULL. Therefore, after the LEFT JOIN, the result will include "a1," "a3" (with a NULL store_id), and "a4."