← 返回 meta 的题目列表SQL Query for Data Processing
类型:online_judge
Write a SQL query to obtain a list of customer names from the sales table who have sales amounts greater than 1000 in the year 2021. The table structure is as follows: sales (id, customer_name, amount, sale_date).
Requirements:
Select all customer_name from the sales table that meet the criteria.
The result should be a unique list of customer names.
If no records meet the criteria, return an empty list.
Example:
Assuming the sales table contains the following data:
| id | customer_name | amount | sale_date | |----|---------------|--------|-------------| | 1 | John Doe | 1500 | 2021-01-15 | | 2 | Jane Smith | 800 | 2021-02-20 | | 3 | John Doe | 900 | 2021-03-10 | | 4 | Alice Johnson | 1700 | 2021-04-30 |
The SQL query should return: ['John Doe', 'Alice Johnson']
Example
Input
id,customer_name,amount,sale_date
1,John Doe,1500,2021-01-15
2,Jane Smith,800,2021-02-20
3,John Doe,900,2021-03-10
4,Alice Johnson,1700,2021-04-30