SELECT * FROM buildings WHERE building_name NOT IN (SELECT building FROM employees)
I’m trying to answer exercise 2 with the above (try it yourself here: https://sqlbolt.com/lesson/select_queries_with_nulls), but it’s not returning anything. Is it a problem with the site or my query?
Thanks!
Advertisement
Answer
I checked your query, according to the question that was on the site, you can easily extract the desired data using a sub-query.
in this query first of all we get list of building name that have employees after that get list of building not have any employees
select * from buildings where building_name not in (select building from employees where building not null group by building)