【发布时间】:2022-01-20 12:27:42
【问题描述】:
- 针对单个表运行 AWS Athena SQL 查询,了解每个国家/地区的唯一用户总数。
- 允许用户出现在多个国家/地区,但每个国家/地区只能出现一次。
此查询返回所有国家/地区的唯一用户,但不允许一个用户在多个国家/地区是唯一的:
select
country_code,
count(user_id) as unique_users_per_country
from
user_data
group by
country_code
order by
country_code asc
表结构:
|Column Name|Data Type|
|timestamp|bigint|
|user_id|string|
|country_code|string|
谢谢。
【问题讨论】:
标签: sql amazon-web-services group-by amazon-athena