Use WHERE NOT EXISTS
and Outer Joins
For all universal Programmes:
SELECT * FROM Programme
WHERE NOT EXISTS (SELECT * FROM
(Participation NATURAL JOIN Programme) LEFT JOIN Employee
USING (Eid,Department)
WHERE Employee.Eid IS NULL)
This should be fairly easy to explain - selects all programs where the is no employee not participating
For all enthusiatic employees:
SELECT * FROM Employee
WHERE NOT EXISTS (SELECT * FROM
Employee LEFT JOIN Participation
USING (Eid,department)
WHERE Participation.Eid IS NULL)
Again - selects all employyes where there are no programs in the same department in which that employee is not participating.
This may look familiar if you are familiar with formal logic at all - universal quantification is generally defined in terms of negated existential qualification