this week’s database system practice post test: making the most spaghetti SQL queries:
-- no intersect =(
select distinct (
select name
from Lecturers
where id=C1.lecturer_id
limit 1
) as name
from Courses as C1
where
exists(
select 1
from Courses as C2
where
C2.lecturer_id=C1.lecturer_id
and C2.semester='Odd'
)
and exists(
select 1
from Courses as C2
where
C2.lecturer_id=C1.lecturer_id
and C2.semester='Even'
)
;(we’re learning set operations and subqueries, so joins are not allowed)
this might not be neccesary, but do you know basic set theory
yes but I can’t use
intersect, the version of MySQL that the computers at the lab has doesn’t have it