当前位置:网站首页>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;
边栏推荐
- What is Tianji 920 equivalent to a snapdragon? How much is Tianji 920 equivalent to a snapdragon? How about Tianji 920
- 基金开户网上办理是否安全?谁给解答一下
- 寻找峰值[抽象二分练习]
- Pycharm读取Excel文件时报错:raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+ ; not supported )
- Find the maximum area of the island -- depth first search (staining method)
- 炫酷代码雨动态背景注册页面
- 581. 最短无序连续子数组
- shell跑的時候需要的需要了解命令
- 剑指 Offer 46. 把数字翻译成字符串
- How can manual testing turn to automated testing? Byte 5 years of automation experience talk about
猜你喜欢

JS calendar style pie chart statistics plug-in

ArcGIS使用DEM数据划定汇水区具体步骤过程
![[review of analog electricity - diode]](/img/dc/7b3c3187000be24053f0e69733444d.jpg)
[review of analog electricity - diode]

The difference between Celeron n4000 and Celeron n5095

ThreadLocal interview Kills 11 consecutive questions

Is there a big gap between core i5 12490f and i5 12600K

Cool code rain dynamic background registration page

How about the performance of Intel Celeron 7300? What level is it equivalent to

Stream stream is used for classification display.

STM32 outputs SPWM wave, Hal library, cubemx configuration, and outputs 1kHz sine wave after filtering
随机推荐
Offline data interoperability
OKRK3399開發板預留I2C4掛載EEPROM
How about the performance of Ruilong R7 Pro 5875u? What level is it equivalent to
Shell实践:一键启动进程、关闭进程、查看进程状态
Okrk3399 Development Board Reserved i2c4 Mounting EEPROM
JS数据类型判断方式总结
拖拽----
FPGA工程师如何进行复杂系统设计?
js日历样式饼图统计插件
Aruba learning notes 05 configuration architecture WLAN configuration architecture
Fabric. JS basic brush
How many processors is Tianji 820 equivalent to Xiaolong? How about Tianji 1100 equivalent to Xiaolong? How about Tianji 820
Renforcement de l'apprentissage - points de compréhension du gradient stratégique
[baiqihang] Niuer education helps colleges and universities visit enterprises, expand posts and promote employment
子序列 --- 编辑距离
ThreadLocal 面试夺命11连问
强化学习——策略梯度理解点
Pagehepler lost the pit of the original SQL order by condition
动态规划-- 背包问题
Surrounded Regions