SQL65. 按照数量和价格排序
描述
quantity | item_price |
1 | 100 |
10 | 1003 |
2 | 500 |
示例1
输入:
DROP TABLE IF EXISTS `OrderItems`; CREATE TABLE IF NOT EXISTS `OrderItems` ( `quantity` INT(64) NOT NULL COMMENT '数量', `item_price` INT(64) NOT NULL COMMENT '订单价格' ); INSERT INTO `OrderItems` VALUES (1,100), (10,1003), (2,500);
输出:
10|1003 2|500 1|100
Mysql 解法, 执行用时: 38ms, 内存消耗: 6456KB, 提交时间: 2022-03-02
SELECT * FROM OrderItems ORDER BY quantity DESC,item_price DESC
Mysql 解法, 执行用时: 38ms, 内存消耗: 6568KB, 提交时间: 2022-03-03
SELECT quantity,item_price FROM OrderItems ORDER BY quantity DESC, item_price DESC;
Mysql 解法, 执行用时: 38ms, 内存消耗: 6592KB, 提交时间: 2022-03-04
select quantity,item_price FROM OrderItems Order BY quantity desc ,item_price desc
Mysql 解法, 执行用时: 38ms, 内存消耗: 6884KB, 提交时间: 2022-03-03
select * from OrderItems order by quantity desc, item_price desc;
Mysql 解法, 执行用时: 39ms, 内存消耗: 6448KB, 提交时间: 2022-03-06
select quantity,item_price from OrderItems order by quantity desc,item_price desc