TASK 8 A short note on NULLs Flashcards

1
Q

Find the name and role of all employees who have not been assigned to a building

A

SELECT name, role FROM employees
WHERE building IS NULL;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Find the names of the buildings that hold no employees

A

SELECT DISTINCT building_name
FROM buildings
LEFT JOIN employees
ON building_name = building
WHERE role IS NULL;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly