Consider the following relational database schema. It is intended to represent who will eat what
kinds of sandwiches and the places which serve the various kinds of sandwiches. A sample
database instance is also given.

Write SQL statements to retrieve the following information:
(i) places where Jones can eat (using a nested subquery).
SELECT ADDRESS FROM Locations WHERE LNAME IN
(SELECT LOCATION from sandwiches where FILLING in
(SELECT FILLING FROM tastes WHERE NAME = 'Jones'))
(ii) places where Jones can eat (without using a nested subquery).
(ii) for each location the number of people who can eat there.
SQL查询示例
本文提供了一个SQL查询示例,展示了如何使用嵌套子查询及非嵌套子查询来获取特定人员可以就餐的地点信息,并进一步统计了每个地点可以就餐的人数。

被折叠的 条评论
为什么被折叠?



