Suppose we have a database consisting of the following three relations.
(Assume that each student likes at least one ice-cream and frequents at least one parlor)
Express the following in SQL:
Print the students that frequent at least one parlor that serves some ice-cream that they like.
This is my Attempt of your Query Pratik
from frequents F
where NOT EXIST
( Select Student, Parlor, Ice-cream
from F NATURAL JOIN Likes L
select Student, Parlor, Ice-cream
from Serves NATURAL JOIN L);
SELECT DISTINCT A.student FROM
FREQUENTS A, SERVES B, LIKES C
SELECT DISTINCT A.student FROM FREQUENTS A
(SELECT parlor FROM SERVES B
WHERE B.ice-cream IN
FROM LIKES C
WHERE C.student = A.student));
For combinatorics , can add balls and bin...