目录
题目
编写解决方案找出 至少有一个 订单的金额 严格大于 500
的客户的数量。
准备数据
Create table If Not Exists Store (bill_id int, customer_id int, amount int)
Truncate table Store
insert into Store (bill_id, customer_id, amount) values ('6', '1', '549')
insert into Store (bill_id, customer_id, amount) values ('8', '1', '834')
insert into Store (bill_id, customer_id, amount) values ('4', '2', '394')
insert into Store (bill_id, customer_id, amount) values ('11', '3', '657')
insert into Store (bill_id, customer_id, amount) values ('13', '3', '257')
分析数据
select count( distinct customer_id) rich_count
from store
where amount > 500;