SQL83. 确定已售出产品的总数
描述
quantity |
10 |
100 |
1000 |
10001 |
2 |
15 |
items_ordered |
11128 |
示例1
输入:
DROP TABLE IF EXISTS `OrderItems`; CREATE TABLE IF NOT EXISTS `OrderItems`( quantity INT(16) NOT NULL COMMENT '商品数量' ); INSERT `OrderItems` VALUES (10),(100),(1000),(10001),(2),(15);
输出:
items_ordered 11128.000
Mysql 解法, 执行用时: 39ms, 内存消耗: 6616KB, 提交时间: 2022-03-03
select sum(quantity) as items_ordered from OrderItems
Mysql 解法, 执行用时: 39ms, 内存消耗: 6628KB, 提交时间: 2022-03-07
select sum(quantity)as items_ordered from OrderItems
Mysql 解法, 执行用时: 40ms, 内存消耗: 6544KB, 提交时间: 2022-04-17
select sum(quantity) as items_ordered from OrderItems
Mysql 解法, 执行用时: 40ms, 内存消耗: 6576KB, 提交时间: 2022-05-09
select sum(quantity)items_ordered from OrderItems
Mysql 解法, 执行用时: 40ms, 内存消耗: 6632KB, 提交时间: 2022-07-21
select SUM(quantity) as items_ordered from OrderItems; # SELECT # SUM(quantity) items_ordered # FROM # OrderItems;