失效链接处理 |
数据库原理-第三章作业SQL解答 PDF 下载
本站整理下载:
相关截图:
主要内容:
本题主要考核的 SQL 语句,一般情况对于多表查询,通常同一个查询可以有不
同方案,所以关注方案的差异。同样需要注意 SQL 运算符及其格式的规范性,
一般情况下能用一张表就不用两张表,能用两张表就不用三张表,以此类推。
或:
select customer_name from depositor
where customer_name not in
(select customer_name from borrower)
b. 以下为最简略形式,但 sql server 不支持,但作业可以算正确。注意:一
张表用两次需要更名。
其它方法:
select F.customer name
from customer F , customer S
where S.customer_name = ’Smith’
and S.customer_street=F. customer_street
and S.customer_city=F. customer_city
c. 方法一
方法二
select distinct branch_name
from account , depositor, customer
where account. account_number= depositor. account_number
and depositor.customer_name= customer.customer_name
and customer_city = ’Harrison’
方法三:
select distinct branch_name
from account
where account_number in
(select account_number
from depositor
where customer_name in
(select customer_name
from customer
where customer_city = ’Harrison’))
|