SQL Left Join
6.If B has duplicates in id, what happens?
SELECT A.id, B.name
FROM A LEFT JOIN B ON A.id = B.id;
-
A. Only one match returned
-
B. All matches duplicated
-
C. NULL
-
D. Error
All matches duplicated
All matches duplicated
7.If a student has no mark entry?
SELECT *
FROM students LEFT JOIN marks
ON students.id = marks.student_id;
-
A. Row skipped
-
B. student_id = NULL
-
C. NULL for marks
-
D. Error
NULL for marks
NULL for marks
8.LEFT JOIN guarantees inclusion of:
-
A. All left table rows
-
B. All right table rows
-
C. Only matched records
-
D. No NULLs
All left table rows
All left table rows
9.LEFT JOIN is used when:
-
A. You want unmatched rows from left
-
B. You want only matched
-
C. You want unmatched from both
-
D. You want full cartesian
You want unmatched rows from left
You want unmatched rows from left