SQL70. 返回更多的产品
描述
order_num | quantity |
a1 | 105 |
a2 | 1100 |
a2 | 200 |
a4 | 1121 |
a5 | 10 |
a2 | 19 |
a7 | 5 |
order_num |
a1 |
a2 |
a4 |
示例1
输入:
DROP TABLE IF EXISTS `OrderItems`; CREATE TABLE IF NOT EXISTS `OrderItems`( order_num VARCHAR(255) NOT NULL COMMENT '商品订单号', quantity VARCHAR(255) NOT NULL COMMENT '商品数量' ); INSERT `OrderItems` VALUES ('a1','105'),('a2','1100'),('a2','200'),('a4','1121'),('a5','10'),('a2','19'),('a7','5')
输出:
a1 a2 a4
Mysql 解法, 执行用时: 38ms, 内存消耗: 6500KB, 提交时间: 2022-03-03
SELECT DISTINCT order_num FROM OrderItems WHERE quantity >= 100
Mysql 解法, 执行用时: 39ms, 内存消耗: 6436KB, 提交时间: 2022-03-07
select distinct order_num from OrderItems where quantity >= 100
Mysql 解法, 执行用时: 39ms, 内存消耗: 6448KB, 提交时间: 2022-03-03
select DISTINCT order_num from OrderItems where quantity>100
Mysql 解法, 执行用时: 39ms, 内存消耗: 6448KB, 提交时间: 2022-03-02
select distinct order_num from OrderItems where quantity>=100
Mysql 解法, 执行用时: 39ms, 内存消耗: 6456KB, 提交时间: 2022-03-04
select distinct order_num from OrderItems where quantity>100