CBSE Class 12 Informatics Practices
Question 74 of 91
JOINS and SET Operations — Question 10
Back to all questionsIn a LEFT JOIN, all rows from the left table are included along with matching rows from the right table, and NULL values are used for non-matching rows in the right table. Conversely, a natural join is a join where only one of the identical columns from the joined tables exists.
1. LEFT JOIN Example:
SELECT name, lastname
FROM empl LEFT JOIN dept ON empl.id = dept.id;The result of this query would return name and lastname values from the empl table and all available values from the dept table. NULL is returned for non-existing values in dept table.
2. NATURAL JOIN Example:
SELECT * FROM empl NATURAL JOIN dept;The query returns all columns from empl and dept tables, with rows having matching values in their common columns.