10-141 6-3 查询厂商“A“生产的PC的平均价格 -- 10-150 查询图书表中所有记录 合集

10-141 6-3 查询厂商"A"生产的PC的平均价格

本题目要求编写SQL语句,
查询厂商A生产的PC的平均价格。

select avg(price) as avg_price
from product join pc on product.model=pc.model
where maker='A'

10-142 6-4 查询厂商"D"生产的PC和便携式电脑的平均价格

本题目要求编写SQL语句,
查询厂商D生产的PC和便携式电脑的平均价格。

SELECT round(AVG(price)) AS avg_price
FROM (SELECT price
FROM product,pc
WHERE product.model = pc.model AND maker = 'D'
UNION ALL
SELECT price
FROM product,laptop
WHERE product.model = laptop.model AND maker = 'D') temp

10-143 6-6 查询各厂商生产的便携式电脑的显示器平均尺寸

本题目要求编写SQL语句,
查询各厂商生产的便携式电脑的显示器平均尺寸。

select maker,avg(screen) as avg_screen
from product join laptop on product.model=laptop.model
where type='便携式电脑'
group by maker

10-144 6-7 查询生产三种不同型号的PC的厂商

本题目要求编写SQL语句,
查询生产种不同型号的PC的厂商。

select distinct maker
from pc join product on product.model=pc.model
group by maker
having count(*)>2

10-145 6-8 查询各厂商生产的PC的最高价格

本题目要求编写SQL语句,
查询各厂商生产的PC的最高价格。

select maker,max(price) as max_price
FROM pc,product
where pc.model=product.model
GROUP BY maker

10-146 6-9查询速度超过150MHZ的各种速度的PC的平均价格

本题目要求编写SQL语句,
查询速度超过150MHZ的各种速度的PC的平均价格。

select speed,avg(price) as avg_price
from pc
where speed>150
group by speed

10-147 A4-7在订单详细信息表中查找包含产品种类数超过特定值的订单信息

订单详情表(orderdetails)中查找订单中包含的不同产品的个数超过2的订单信息,显示订单号(OrderID)和总数量(重命名为totalQuantity 

select OrderID,sum(Quantity) as totalQuantity
from orderdetails
group by OrderID
having count(ProductID)>2

10-148 B1-3查询特定供应商及其供应的产品情况

查找来自国家(Country)JapanUSA各个供应商名称及其供应的产品,显示为:供应商编号(SupplierID)公司名称(CompanyName)产品编号(ProductID)产品名称(ProductName)

提示:请使用SELECT语句作答。

select products.ProductID,products.ProductName,suppliers.SupplierID,suppliers.CompanyName
from products,suppliers
where suppliers.SupplierID=products.SupplierID AND suppliers.Country in('Japan','USA')

10-149 B1-4统计各个供应商及其供应情况

统计各个国家(Country)的供应商的供应产品情况,显示为:国家(Country),库存总量(重命名为sumUnitsInStock),平均单价(重命名为avgUnitPrice

提示:请使用SELECT语句作答。

select suppliers.Country,sum(products.UnitsInStock) as sumUnitsInStock ,avg(products.UnitPrice) as avgUnitPrice
from products,suppliers
where suppliers.SupplierID=products.SupplierID
group by suppliers.Country

10-150 查询图书表中所有记录

本题目要求编写SQL语句,检索出图书表中所有记录。

提示:请使用SELECT语句作答。

select * from 图书

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

THK-J

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值