第一范文网 - 专业文章范例文档资料分享平台

南京理工大学《数据库系统基础教程》试题和答案

来源:用户分享 时间:2025/10/8 16:34:20 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

Select maker From product,pc Where product.model=pc.model);

d) Find those hard-disk sizes that occur in two or more PC’s. Select p1.hd

From pc as p1,pc as p2

Where p1.model<>p2.model and p1.hd=p2.hd;

e) Find those pairs of PC models that have both the same speed and RAM. Select p1.model,p2.model From pc as p1,pc as p2

Where p1.model

f) Find those manufacturers of at least two different computers (PC’s or laptops) with speeds of at least 133.

Select maker From product,pc

Where speed>133 and product.model=pc.model and maker IN (Select maker From product,laptop

Where speed>133 and product.model=laptop.model );

P269 5.3.1

a) Find the makers of PC’s with a speed of at least 160. Select maker From product

Where model in (select model from pc where speed >=160);

Select maker From product

Where model =any (select model from pc where speed >=160);

33

Select maker From product

Where exists (select * from pc where speed >=160 and model=product.model); b) Find the printer with the highest price. Select model From printer

Where price >= all (Select price from printer);

Select model From printer

Where not price < any (Select price from printer);

Select model From printer as p

Where not exists (select * from printer where price>p.price); c) Find the laptop whose speed is slower than that of any pc. Select model From laptop

Where speed < all (Select speed From pc);

Select model From laptop

Where not exists (Select * From pc where speed

34

Where price>=all (select price from pc) and price>=all (select price from laptop) and price>=all (select price from printer)) union

(Select model From laptop

Where price>=all (select price from pc) and price>=all (select price from laptop) and price>=all (select price from printer)) union

(Select model From printer

Where price>=all (select price from pc) and price>=all (select price from laptop) and price>=all (select price from printer));

e) Find the maker of the color printer with the lowest price. Select maker From product

Where model in (select model from printer where color

and price <= all (Select price From printer

Where color));

f) Find the maker of the PC with the fastest processor among all those PC’s that have the smallest amount of RAM. Select maker From product, pc

Where product.model=pc.model and ram<=all (Select ram From pc)

and speed >= all ( Select speed From pc

where ram<=all (Select ram From pc));

35

p278 5.5.1

a) Find the average speed of PC’s. select avg(speed) from pc;

b) Find the average speed of laptops costing over $2500. select avg(speed) from laptop where price>2500;

c) Find the average price of PC’s made by manufacturer “A”. select avg(price) from product, pc

where product.model=pc.model and maker=’A’;

d) Find the average price of PC’s and laptops made by manufacturer “D”. select

(sum(pc.price)/count(distinct

laptop.model)+

sum(laptop.price)/count(distinct

pc.model))/(count(distinct laptop.model)+count(distinct pc.model)) from pc, laptop

where pc.model in (select model from product where maker=’D’) and laptop.model in (select model from product where maker=’D’);

create view pd as

((select product.model, price from product, pc

where product.model=pc.model and maker=’D’) union

(select product.model, price from product, laptop

where product.model=laptop.model and maker=’D’));

36

南京理工大学《数据库系统基础教程》试题和答案.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c46y2n3bnmo8njyy27jj2_9.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top