当前位置:网站首页>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;
边栏推荐
- js软件卸载提示表情跟随鼠标变化js特效
- 104 二叉树的最大深度 和 543 二叉树的直径和 124 二叉树的最大路径和
- Experience in developing large crawlers in requests Library
- Chicken and egg, products and Strategies
- 手机股票开户风险性大吗,安全吗?
- spotlight灯箱js插件全屏放大图片
- How about the performance of Intel Celeron 7300? What level is it equivalent to
- 求岛屿最大面积--深度优先搜索(染色法)
- Comparison of iqoo 10 pro and Xiaomi 12 ultra configurations
- Find the maximum area of the island -- depth first search (staining method)
猜你喜欢

What level is the notebook core i5 1135g7 equivalent to? How about i5 1135g7 performance

Pagehepler lost the pit of the original SQL order by condition

数据库连接池 & DBUtils

How about the performance of Ruilong R7 Pro 5875u? What level is it equivalent to

LabVIEW运行中改变Chart的历史长度

wacom固件更新错误123,数位板驱动更新不了

Day 5 experiment
![寻找峰值[抽象二分练习]](/img/99/122e79784f0f07120680d2cbcf89da.png)
寻找峰值[抽象二分练习]

打家劫舍!

STM32 outputs SPWM wave, Hal library, cubemx configuration, and outputs 1kHz sine wave after filtering
随机推荐
优化华为云服务器采用Key登陆
Is it risky and safe to open a mobile stock account?
Antd form - reset method does not work - Basic accumulation - importance of prop
接口interface
Experience in developing large crawlers in requests Library
STM32输出SPWM波,HAL库,cubeMX配置,滤波后输出1KHz正弦波
采样和数据驱动
OKRK3399开发板预留I2C4挂载EEPROM
力扣142题:环形链表2
Surrounded Regions
打家劫舍!
Fabric.js 基础笔刷
C语言实现memcpy、memmove
Summary of JS data type judgment methods
FPGA工程师如何进行复杂系统设计?
Find the maximum area of the island -- depth first search (staining method)
LabVIEW运行中改变Chart的历史长度
What level of rtx3070ti graphics card? What level of rtx3070ti graphics card? How about rtx3070ti graphics card
Description of test platform and hardware design
买卖股票的最佳时机