1821. 寻找今年具有正收入的客户
写一个 SQL 查询来查询 2021 年具有 正收入 的客户。
可以按 任意顺序 返回结果表。
查询结果格式如下例。
分析:
这里不需要使用distinct 或 group by去重,因为给的是某一年整体的收入,在where 就已经筛选出一年的整体收入了。
select
customer_id
from
Customers
where
year='2021'
and
revenue > 0
1821. 寻找今年具有正收入的客户
写一个 SQL 查询来查询 2021 年具有 正收入 的客户。
可以按 任意顺序 返回结果表。
查询结果格式如下例。
分析:
这里不需要使用distinct 或 group by去重,因为给的是某一年整体的收入,在where 就已经筛选出一年的整体收入了。
select
customer_id
from
Customers
where
year='2021'
and
revenue > 0