欢迎光临散文网 会员登陆 & 注册

database_leetcode2082. The Number of Rich Customers

2022-02-22 17:42 作者:您是打尖儿还是住店呢  | 我要投稿

Write an SQL query to report the number of customers who had at least one bill with an amount strictly greater than 500.
The query result format is in the following example.

Example 1:
Input: Store table:

+---------+-------------+--------+

| bill_id | customer_id | amount |

+---------+-------------+--------+

| 6       | 1           | 549    |

| 8       | 1           | 834    |

| 4       | 2           | 394    |

| 11      | 3           | 657    |

| 13      | 3           | 257    |

+---------+-------------+--------+

Output:

+------------+

| rich_count |

+------------+

| 2          |

+------------+

Explanation: Customer 1 has two bills with amounts strictly greater than 500.Customer 2 does not have any bills with an amount strictly greater than 500.Customer 3 has one bill with an amount strictly greater than 500.


database_leetcode2082. The Number of Rich Customers的评论 (共 条)

分享到微博请遵守国家法律