qwjAAA数据库实验答案

上传人:日度 文档编号:136426196 上传时间:2020-06-28 格式:DOC 页数:14 大小:51KB
返回 下载 相关 举报
qwjAAA数据库实验答案_第1页
第1页 / 共14页
qwjAAA数据库实验答案_第2页
第2页 / 共14页
qwjAAA数据库实验答案_第3页
第3页 / 共14页
qwjAAA数据库实验答案_第4页
第4页 / 共14页
qwjAAA数据库实验答案_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《qwjAAA数据库实验答案》由会员分享,可在线阅读,更多相关《qwjAAA数据库实验答案(14页珍藏版)》请在金锄头文库上搜索。

1、1)找出 MGM studios 的地址。select 地址 from 制片公司where 公司名称=MGM studios2)找出 Sandra Bullock 的出生日期。select 生日from 电影明星where 姓名=Sandra Bullock3)找出在2003年拍摄过电影的所有影星,或者拍摄过电影中含有天空的电影的所有明星。select 演员姓名from 演员参演电影where 拍摄年份=2003 or 电影名称 like%天空%4)找出净资产至少1000万美元的所有行政长官。select 姓名from 制片人与行政总裁where 资产=100000005)找出所有的男影星或者

2、是住址中含有 Malibu 的影星。select 姓名from 电影明星where 地址 like Malibu or 性别 like 男1)电影加勒比海盗4中的男影星都有谁。select 姓名from 电影明星where 性别 =男 and 姓名 in(select 演员姓名from 演员参演电影where 电影名称=加勒比海盗4)2)谁是米高梅制片公司的总裁。select 姓名from 制片人与行政总裁where 身份证号 =(select 行政总裁from 制片公司where 公司名称 =MGM studios)4)那些电影比乱世佳人更长。select 电影名称from 电影where

3、长度 (select 长度from 电影where 电影名称 = 乱世佳人)5)那些行政长官比 Tom 更富有。select 姓名from 制片人与行政总裁where 资产(select 资产from 制片人与行政总裁where 姓名=Tom)1、找出价格低于6000元的PC计算机型号、速度、以及硬盘容量。select 型号,速度,硬盘容量from PC电脑where 价钱 60002、同上要求,另外将 速度 改名为 兆赫,将 硬盘 改名为 G字节。select 型号,速度 兆赫,硬盘容量 G字节from PC电脑where 价钱 60005、从打印机关系中找出所有彩色打印机的元组。selec

4、t *from 打印机where 是否彩色 = 是6、找出具有300GB以上的硬盘容量而价格低于2000元的所有个人计算机的型号、速度及硬盘。select 型号,速度,硬盘容量from PC电脑where 硬盘容量300 and 价钱 3002、找出由生产厂商苹果生产的所有产品的型号和价格。select 型号,价钱from PC电脑where 型号 in(select 产品型号from 产品where 制造商=苹果)unionselect 型号,价钱from 便携式电脑where 型号 in(select 产品型号from 产品where 制造商=苹果)unionselect 型号,价钱fro

5、m 打印机where 型号 in(select 产品型号from 产品where 制造商=苹果)3、找出所有出售便携式电脑(而不出售PC)的生产厂商。select 制造商from 产品where 产品类型 LIKE 便携式电脑 and 制造商 not in(select 制造商from 产品where 产品类型 LIKE PC电脑 or 产品类型 LIKE 打印机)4、找出在两种或两种以上PC上出现的硬盘容量。select 硬盘容量from PC电脑group by 硬盘容量having count(*)=25、找出拥有相同速度和内存的PC的成对的型号。select distinct Q.型号

6、,P.型号from PC电脑 Q, PC电脑 Pwhere Q.速度=P.速度 and Q.内存=P.内存 and Q.型号=1500)2、找出价格最高的打印机。(注意 all 和 any 的区别) (=all和=max()select 型号from 打印机where 价钱 =all(select 价钱from 打印机)3、找出速度低于任何PC的便携式电脑。(注意all和any的区别)select 型号from 便携式电脑where 速度 all(select 速度from PC电脑)4、找出具有最高价格的机器(PC,便携式电脑或打印机)的型号。select 型号from PC电脑where

7、价钱=(select MAX(价钱)from PC电脑)unionselect 型号from 便携式电脑where 价钱=(select MAX(价钱)from 便携式电脑)unionselect 型号from 打印机where 价钱=(select MAX(价钱)from 打印机)5、找出具有最低价格的彩色打印机的制造商。(=any和in =all和MIN()select 制造商from 产品where 产品型号 =any(select 型号from 打印机where 价钱=all(select 价钱from 打印机where 是否彩色 =是)6、找出在具有最小内存容量的所有 PC 中,具有

8、最快处理器的 PC 制造商。select 制造商from 产品where 产品型号 =any(select 型号from PC电脑where 速度 =(select MAX(速度) from PC电脑where 内存=all(select 内存from PC电脑)and 内存 in(select min(内存)from pc电脑)select 制造商from 产品where 产品型号 in(select 型号from PC电脑where 速度=(select MAX(速度)from PC电脑where 内存=(select MIN(内存)from PC电脑)and 内存 in(select M

9、IN(内存)from pc电脑)select 制造商from 产品,PC电脑where 产品.产品型号=PC电脑.型号 andPC电脑.速度=(select MAX(速度)from PC电脑where 内存133 and 产品类型 LIKE PC电脑 or 产品类型 LIKE 便携式电脑 and 制造商 in(select min(制造商)from vproductgroup by 制造商having COUNT(产品型号)=2)3、找出生产最高速度的计算机(PC电脑或便携式电脑)厂商。select distinct 制造商from vproductwhere 速度133 and 产品类型 L

10、IKE PC电脑 or 产品类型 LIKE 便携式电脑 and 制造商 in(select min(制造商)from vproductgroup by 制造商having COUNT(产品型号)=2)create view 最高速度1asselect distinct 制造商from 产品,PC电脑where 产品.产品型号=PC电脑.型号and 速度=(select MAX(速度)from PC电脑)unionselect distinct 制造商from 产品,便携式电脑where 产品.产品型号=便携式电脑.型号and 速度=(select MAX(速度)from 便携式电脑 )4、找出至少生产三种不同速度 PC的厂商。select distinct 制造商from vproductwhere 产品类型 LIKE PC电脑 and 制造商 in (select min(制造商) from vproduct group by 产品类型 having count(速度)=3)5.找出只卖三种不同型号的PC的厂商。create view 三种asselect 制造商from 产品 A where A.产品型号=any(select 型号from PC电脑 )AND A.制造商 not in (select B.制造商from 产品 Bwhere 产品类型=

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 中学学案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号