表: Orders
±----------------±---------+
| Column Name | Type |
±----------------±---------+
| order_number | int |
| customer_number | int |
±----------------±---------+
Order_number是该表的主键。
此表包含关于订单ID和客户ID的信息。
编写一个SQL查询,为下了 最多订单 的客户查找 customer_number 。
测试用例生成后, 恰好有一个客户 比任何其他客户下了更多的订单。
题目解答# Write your MySQL query statement below
# select count(customer_number) as customer_number from Orders;
# Write your MySQL query statement below
SELECT
customer_number
FROM
orders
GROUP BY customer_number
ORDER By COUNT(*) desc
LIMIT 1;
题目运行
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)