- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
数据库5th第三章课后部分习题答案
3.1
*************************************************************
Note: The participated relation relates drivers, cars, and accidents.
a.
Note: this is not the same as the total number of accidents in 1989.We must count people with several accidents only once.
select count (distinct name)
from accident, participated, person
where accident.report number = participated.report number
and participated.driver id = person.driver id
and date between date ’1989-00-00’ and date ’1989-12-31’
b.
insert into accident
values (4007, ’2001-09-01’, ’Berkeley’)
insert into participated
select o.driver id, c.license, 4007, 3000
from person p, owns o, car c
where = ’Jones’ and p.driver id = o.driver id and
o.license = c.license and c.model = ’Toyota’
c.
delete car
where model = ’Mazda’ and license in
(select license
from person p, owns o
where = ’John Smith’ and p.driver id = o.driver id)
*************************************************************
3.2
a. Query:
select e.employee name, city
from employee e, works w
where pany name = ’First Bank Corporation’ and
w.employee name = e.employee name
b.
If people may work for several companies, the following solution will only list those who earn more than $10,000 per annum from “First Bank Corporation” alone.
select *
from employee
where employee name in
(select employee name
from works
where company name = ’First Bank Corporation’ and salary ? 10000)
c.
The following solution assumes that all people work for exactly one company.
select employee name
from works
where company name _= ’First Bank Corporation’
If one allows people to appear in the database (e.g. in employee) but not appear in works, or if people may have jobs with more than one company, the solution is slightly more complicated.
select employee name
from employee
where employee name not in
(select employee name
from works
where company name = ’First Bank Corporation’)
d.
The following solution assumes that all people work for at most one company.
select employee
您可能关注的文档
- 数学(人教实验版)中考复习金银卷(二十七)知识提升训练(二十七)相似投影与视图.doc
- 云南省西双版纳傣族自治州民族中学2013-2014学年八年级物理上学期期中试题.doc
- 数学(必修5)第2章教案(表格式,有三维目标).doc
- 云南省西双版纳傣族自治州民族中学2013-2014学年高二物理上学期期中试题理.doc
- 新人教版七年级思想品德上册.doc
- 数学13届高三理科数学海淀八模测试卷(五)及答案(本周四4.25作业).doc
- 数学2.2.1《条件概率》教案(新人教B版选修2-3).doc
- 新人教版七年级上册_Unit_3_Is_this_your_pencil单元复习课件.ppt
- 数学2.2.2《对数函数的图像和性质说课稿》教案(新人教A版必修1).doc
- 数学24.2与圆有关的位置关系教案(共4课时)(人教新课标九年级上).doc
文档评论(0)