最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

LeetCode2752Customers with Maximum Number of Transactions on Con

2023-08-12 09:03 作者:您是打尖兒還是住店呢  | 我要投稿

Description

Table:?Transactions

+------------------+------+?

| Column Name ? ? ?| Type |?

+------------------+------+?

| transaction_id ? | int ?|?

| customer_id ? ? ?| int ?|?

| transaction_date | date |?

| amount ? ? ? ? ? | int ?|?

+------------------+------+?

transaction_id is the primary key of this table. Each row contains information about transactions that includes unique (customer_id, transaction_date) along with the corresponding customer_id and amount. ?

Write an SQL query to find all?customer_id?who made the maximum number of transactions on consecutive days.

Return?all?customer_id?with the maximum number of consecutive transactions.?Order the result table by?customer_id?in?ascending?order.

The query result format is in the following example.

?

Example 1:

Input:?

Transactions table:

+----------------+-------------+------------------+--------+?

| transaction_id | customer_id | transaction_date | amount |?

+----------------+-------------+------------------+--------+?

| 1 ? ? ? ? ? ? ?| 101 ? ? ? ? | 2023-05-01 ? ? ? | 100 ? ?|?

| 2 ? ? ? ? ? ? ?| 101 ? ? ? ? | 2023-05-02 ? ? ? | 150 ? ?|?

| 3 ? ? ? ? ? ? ?| 101 ? ? ? ? | 2023-05-03 ? ? ? | 200 ? ?|

| 4 ? ? ? ? ? ? ?| 102 ? ? ? ? | 2023-05-01 ? ? ? | 50 ? ? |?

| 5 ? ? ? ? ? ? ?| 102 ? ? ? ? | 2023-05-03 ? ? ? | 100 ? ?|?

| 6 ? ? ? ? ? ? ?| 102 ? ? ? ? | 2023-05-04 ? ? ? | 200 ? ?|?

| 7 ? ? ? ? ? ? ?| 105 ? ? ? ? | 2023-05-01 ? ? ? | 100 ? ?|?

| 8 ? ? ? ? ? ? ?| 105 ? ? ? ? | 2023-05-02 ? ? ? | 150 ? ?|?

| 9 ? ? ? ? ? ? ?| 105 ? ? ? ? | 2023-05-03 ? ? ? | 200 ? ?|?

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

Output:?

+-------------+?

| customer_id |

+-------------+?

| 101 ? ? ? ? |?

| 105 ? ? ? ? |?

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

Explanation:?

- customer_id 101 has a total of 3 transactions, and all of them are consecutive. - customer_id 102 has a total of 3 transactions, but only 2 of them are consecutive. - customer_id 105 has a total of 3 transactions, and all of them are consecutive. In total, the highest number of consecutive transactions is 3, achieved by customer_id 101 and 105. The customer_id are sorted in ascending order.


LeetCode2752Customers with Maximum Number of Transactions on Con的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
莱阳市| 桂阳县| 嘉祥县| 福清市| 秀山| 大安市| 安康市| 尼玛县| 临高县| 阿拉善左旗| 宜兴市| 桐城市| 赣州市| 甘肃省| 连山| 黑山县| 峨眉山市| 蓬安县| 泊头市| 嘉义县| 银川市| 宁安市| 南充市| 玛沁县| 日照市| 安图县| 阿巴嘎旗| 紫金县| 习水县| 古丈县| 南木林县| 隆尧县| 南江县| 遂宁市| 昌乐县| 海城市| 长宁县| 依兰县| 清丰县| 温州市| 平凉市|