Frequents(Kid, Store)
Sells(Store, Candy)
Likes(Kid, Candy)
설명
Frequents
→ 어떤 kid가 어떤 store에 자주 가는지
Sells
→ 어떤 store가 어떤 candy를 파는지
Likes
→ 어떤 kid가 어떤 candy를 좋아하는지
모든 attribute는 string이다.
List the stores that sell at least one kind of candy that each kid likes as kid-store pairs.
If there is no such store for a kid, show null paired with that kid.
SELECT K.Kid, S.Store
FROM Likes K
LEFT JOIN Sells S
ON K.Candy = S.Candy;
Step1
R1 ← Likes ⨝Candy Sells