假设我们有一个由以下三个关系组成的数据库。
FREQUENTS(student, parlor) giving the parlors each student visits.
SERVES(parlor, ice-cream) indicating what kind of ice-creams each parlor serves.
LIKES(student, ice-cream) indicating what ice-creams each parlor serves.
(Assuming that each student likes at least one ice-cream and frequents at least one parlor)
用 SQL 表达以下内容:
打印至少光顾一间供应他们喜欢的冰淇淋的客厅的学生。回答:
解释:答案:
SELECT DISTINCT FREQUENTS.student FROM
FREQUENTS, SERVES, LIKES
WHERE
FREQUENTS.parlor=SERVES.parlor
AND
SERVES.ice-cream=LIKES.ice-cream
AND
FREQUENTS.student=LIKES.student;
这个问题的测验