当前位置:网站首页>Chapter 4 set operation
Chapter 4 set operation
2022-07-23 14:28:00 【Sand in Changsha】
Q1
select * from product where sale_price > 500
union
select * from product2 where sale_price > 500;
Q2
select * from (select * from product union select * from product2) as u
where product_id not in (
select product_id from product where product_id not in (select product_id from product2)
union
select product_id from product2 where product_id not in (select product_id from product));
Q3
select sp.shop_id, sp.shop_name, sp.quantity,
p.product_id, p.product_name, p.product_type, p.sale_price,
mp.maxp as ' The maximum selling price of this kind of goods '
from product as p
inner join shopproduct as sp
on sp.product_id = p.product_id
inner join (
select product_type, max(sale_price) as maxp from product
group by product_type
) as mp
on mp.product_type = p.product_type and p.sale_price = mp.maxp;
Q4
select p.product_id, p.product_name, p.product_type, p.sale_price
from product as p
inner join (
select product_type, max(sale_price) as maxp from product
group by product_type
) as mp
on mp.product_type = p.product_type and p.sale_price = mp.maxp;
Q5
select p.product_id, p.product_name, p.product_type, p.sale_price,
(select sum(sale_price) from product as p1
where p.sale_price > p1.sale_price
or (p.sale_price = p1.sale_price and p.product_id >= p1.product_id)
) as ' Cumulative sum '
from product as p
order by sale_price;
边栏推荐
- AppScan的安装与使用
- 10年软件测试工程师经验,很茫然....
- [baiqihang] Niuer education helps colleges and universities visit enterprises, expand posts and promote employment
- Chicken and egg, products and Strategies
- CPU,内存,磁盘速度比较
- 买卖股票的最佳时机
- ThreadLocal 面试夺命11连问
- Cool code rain dynamic background registration page
- 第4章 集合运算
- 强化学习——策略梯度理解点
猜你喜欢
![[baiqihang] Niuer education helps colleges and universities visit enterprises, expand posts and promote employment](/img/41/6ef8f24732d9c75046ca8c55fd4841.png)
[baiqihang] Niuer education helps colleges and universities visit enterprises, expand posts and promote employment

Okrk3399 Development Board Reserved i2c4 Mounting EEPROM

AppScan的安装与使用

Canvas 从入门到劝朋友放弃(图解版)

Sampling and data driven

Optimisation du serveur Cloud Huawei avec connexion clé

Rtx3080ti and rtx3080 gap 3080 and 3080ti parameter comparison

STM32 outputs SPWM wave, Hal library, cubemx configuration, and outputs 1kHz sine wave after filtering

Antd form - reset method does not work - Basic accumulation - importance of prop

VK36N5D抗电源干扰/手机干扰 5键5通道触摸检测芯片防呆功能触摸区域积水仍可操作
随机推荐
Uiscrollview (uicollectionview) prohibits horizontal and vertical sliding at the same time
OKRK3399开发板预留I2C4挂载EEPROM
Quanzhi f1c100s/f1c200s learning notes (13) -- lvgl transplantation
JS calendar style pie chart statistics plug-in
ArcGIS使用DEM数据划定汇水区具体步骤过程
What level is the Core i7 1165g7 equivalent to? What grade does the i71165g7 belong to
c语言实现strcmp、strstr、strcat、strcpy
Find the maximum area of the island -- depth first search (staining method)
shell跑的时候需要的需要了解命令
FFmpeg 1 - 概览/安装
C语言实现课堂随机点名系统
几种点云(网格)孔洞填充方法(1)
How about the performance of Ruilong R7 Pro 5875u? What level is it equivalent to
Interface
OKRK3399開發板預留I2C4掛載EEPROM
Stream stream is used for classification display.
买卖股票的最佳时机
LabVIEW运行中改变Chart的历史长度
测试平台、硬件设计描述
VK36N5D抗电源干扰/手机干扰 5键5通道触摸检测芯片防呆功能触摸区域积水仍可操作