pta Mysql题目集 (81-100)
10-81 3-1-(c)查询在st1公司于2018年制作的电影中出演的影星
select distinct starName
from StarsIn,Movie
where StarsIn.movieTitle=Movie.title and StarsIn.movieYear=Movie.year and year=2018 and studioName='st1';
10-82 A1-2根据所在国家查找订单信息
select OrderID,CustomerID
from orders
-- where ShipCountry in ('Germany','Brazil','France');
where ShipCountry = 'Germany' or ShipCountry = 'Brazil' or ShipCountry = 'France';
10-83 A1-3查询顾客表中所有不重复的城市
select distinct City
from customers;
10-84 A1-4在产品表中找出库存数量大于50的产品的信息
select ProductID,ProductName
from products
where UnitsInStock>50
10-85 3-1-(d)查询比电影《M1》时间更长的电影
select title,year
from Movie
where Movie.length >
(select lengthfrom Moviewhere title='M1'
)
10-86 3-1-(e)查询比a1更富有的行政长官
select name
from MovieExec
where netWorth >(select netWorth from MovieExec where name='a1')
and certID in (select presCertID from Studio);
10-87 A1-5在顾客表中找出特定名字的顾客信息
select CustomerID,CompanyName
from customers
where CompanyName like '%th%';
10-88 3-2-(a)查询配置了容量至少为1G字节硬盘的便携式电脑的生产厂商及其速度
select a.maker,b.speed
from product as a,(select model,speed from laptop where hd>=1) as b
where b.model = a.model and a.type = '便携式电脑';
10-89 3-2-(b)查询由生产厂商B生产的所有产品的型号(model) 和价格(price)
select model,price from pc where model in (select model from product where maker ='B')
union
select model,price from laptop where model in (select model from product where maker ='B')
union
select model,price from printer where model in (select model from product where maker ='B');
10-90 3-2-(c)查询所有出售便携式电脑(而不出售PC机)的生产厂商
select distinct maker
from product
where type = '便携式电脑' and maker not in
(select maker from product where type = '个人电脑'
);
10-91 3-2-(d)查询在两种或两种以上PC机上出现的硬盘容量
select hd
from
(
select hd ,count(*) as num
from pc
group by hd
) as a
where num>=2
order by hd asc;
10-92 3-2-(e)查询拥有相同速度和内存的PC机的成对的型号
select a.model as model1,b.model as model2
from pc as a,pc as b
where a.speed = b.speed and a.ram = b.ram and a.model<b.model;
10-93 A1-6在顾客表中找出不是特定城市的顾客信息
select CustomerID,Phone
from customers
where city!='Paris' and city !='Torino' and city !='Madrid';
10-94 A1-7在产品表中找出库存量小于订购量的产品信息
select ProductID,ProductName
from products
where UnitsInStock < UnitsOnOrder
10-95 A1-8查询传真号码不为空的供货商信息
select SupplierID,CompanyName
from suppliers
where Fax is not null;
10-96 A2-1查找产品表中再次订购量大于15的产品信息
select ProductID,ProductName,SupplierID
from products
where ReorderLevel >15
10-97 A2-2查找产品表中再次订购量大于等于10且修订量大于订货数量的产品信息
select ProductID,ProductName,SupplierID
from products
where ReorderLevel >= 10 and ReorderLevel > UnitsOnOrder
order by ProductID;
10-98 A2-3查询产品表中单价不在范围内的的产品
select ProductID,ProductName,CategoryID
from products
where UnitPrice<15 or UnitPrice>45;
10-99 spj-统计各供应商的零件供应量
select a.sno as 供应商号,s.sname as 供应商, sum(qty) as 供应总量
from s,
(
select * from spj where sno not in (select DISTINCT sno from spj where qty<100 )
) as a
where a.sno = s.sno
group by a.sno
order by a.sno;
10-100 spj-显示供应商供应零件的汇总列表
select
coalesce(sno,'所有供应商') as 供应商,
coalesce(pno,'所有零件') as 零件,
sum(qty) as 供应量
from spj
group by sno,pno
with rollup;
pta Mysql题目集 (81-100)相关推荐
- MOOC浙大数据结构课后题记录——PTA数据结构题目集(全)
目录 第一周--最大子列和算法.二分查找 01-复杂度1 最大子列和问题 (20分) 01-复杂度2 Maximum Subsequence Sum (25分) 01-复杂度3 二分查找 (20分) ...
- 中国大学MOOC浙江大学“程序设计入门——C语言”的PTA练习题目集答案
第I阶段,包含变量.语句.循环部分的题目,不包括数组.结构.基础算法的题目.已通过PTA测试点,所用知识均为变量.语句.循环.适合初学者观看,博主技术有限,同样以初学者视角来写,有不足之处还请多多指出 ...
- PTA数据结构题目集 第十一周——散列查找
目录 11-散列1 电话聊天狂人 (25分) 思路 代码 测试点 11-散列2 Hashing (25分) 思路 代码 测试点 11-散列3 QQ帐户的申请与登陆 (25分) 题目大意 思路 代码 测 ...
- PTA数据库题目集第一章
判断题 1.外模式/模式映像可以保证数据与程序的逻辑独立性. 2.数据模型是由数据结构.数据操作和完整性约束三部分组成的 3.数据库体系结构按照 模式 . 外模式 和 内模式 三级结构进行组织 4.数 ...
- PTA基础题目集 7-25 念数字 (15 分)
输入一个整数,输出每个数字对应的拼音.当整数为负数时,先输出fu字.十个数字对应的拼音如下: 0: ling 1: yi 2: er 3: san 4: si 5: wu 6: liu 7: qi 8 ...
- PTA基础题目集 7-28 猴子选大王 (20 分)
一群猴子要选新猴王.新猴王的选择方法是:让N只候选猴子围成一圈,从某位置起顺序编号为1~N号.从第1号开始报数,每轮从1报到3,凡报到3的猴子即退出圈子,接着又从紧邻的下一只猴子开始同样的报数.如此不 ...
- PTA数据结构与算法题目集 6-9 二叉树的遍历
PTA数据结构与算法题目集(中文) 6-9 二叉树的遍历 void InorderTraversal( BinTree BT ){if(BT==NULL)return;if(BT->Left){ ...
- PTA 基础编程题目集 7-27 冒泡法排序 C语言
PTA 基础编程题目集 7-27 冒泡法排序 C语言 将N个整数按从小到大排序的冒泡排序法是这样工作的:从头到尾比较相邻两个元素,如果前面的元素大于其紧随的后面元素,则交换它们.通过一遍扫描,则最后一 ...
- PTA 基础编程题目集 7-21 求特殊方程的正整数解 C语言
PTA 基础编程题目集 7-21 求特殊方程的正整数解 C语言 输入样例1: 884 输出样例1: 10 28 20 22 输入样例2: 11 输出样例2: No Solution #include& ...
最新文章
- 刚盈利的DeepMind收购MuJoCo:转手开源,所有人免费用
- 自学python爬虫要多久-入门Python爬虫要学习多久?
- 设计模式的理解: 职责链模式 (Chain of Responsibility)
- 科学家用大脑控制平板电脑操作 真的可以!
- PHP vs Node.js vs Nginx-Lua(转)
- ajax核心技术1---XMLHttpRequset对象的使用
- 无国界医生_如何在5分钟内创建无国界风格的技能树
- 漫步微积分十四——增、减函数和极大、极小值
- git提交emoji_Emoji-Log:一种编写Git提交消息的新方法
- 开课吧课堂:C++基本数据类型详解
- Excel日期转换mysql_EXCEL与MySQL日期格式转换
- matlab差分方程实验报告,实验二微分方程与差分方程模型matlab求解.doc
- 企业如何自建MDM 移动设备管理平台
- 网络磁干扰仿真测试软件,上面这些软件哪个用来做电路的电磁干扰仿真比较好?...
- 入门必备小游戏之炸金花
- 八大物联网安全关键技术
- 2020总结——人生如逆旅,我亦是行人
- ubuntu18.04 升级内核后,进入系统页面卡在“started gnome display manager“的解决方案
- CMDN Club每周精选(第1期)
- Qt OpenGL 旋转、平移、缩放