五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

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

LeetCode 2701 Consecutive Transactions with Increasing Amounts

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

<p>Table: <code>Transactions</code></p>


<pre>

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

| 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. ?

</pre>


<p>Write an SQL query to find the customers who have made consecutive transactions with increasing <code>amount</code>;for at least three consecutive days. Include the <code>customer_id</code>,;start date of the consecutive transactions;period and the end date of the consecutive transactions period. There can be multiple consecutive transactions by a customer.</p>


<p>Return <em>the result table ordered by</em> <code>customer_id</code> <em>in <strong>ascending</strong> order.</em></p>


<p>The query result format is in the following example.</p>


<p>;</p>

<p><strong class="example">Example 1:</strong></p>


<strong>Input:</strong>;


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|

| 10 | 105 | 2023-05-04 | 300|

| 11 | 105 | 2023-05-12 | 250|

| 12 | 105 | 2023-05-13 | 260|

| 13 | 105 | 2023-05-14 | 270|


<strong>Output:</strong>;


| customer_id | consecutive_start | consecutive_end |

-|-|-|

| 101 | 2023-05-01 |2023-05-03|

| 105 | 2023-05-01 |2023-05-04|

| 105 | 2023-05-12 |2023-05-14|


<strong>Explanation:</strong>

- customer_id 101 has made consecutive transactions with increasing amounts from May 1st, 2023, to May 3rd, 2023

- customer_id 102 does not have any consecutive transactions for at least 3 days.;

- customer_id 105 has two sets of consecutive transactions: from May 1st, 2023, to May 4th, 2023, and from May 12th, 2023, to May 14th, 2023.;

customer_id is sorted in ascending order.


LeetCode 2701 Consecutive Transactions with Increasing Amounts的評論 (共 條)

分享到微博請遵守國家法律
孙吴县| 慈溪市| 陆丰市| 洛南县| 遂宁市| 弥渡县| 奇台县| 吉安县| 吉木乃县| 手机| 玉门市| 喀什市| 平凉市| 潞西市| 雅江县| 江永县| 永春县| 扎兰屯市| 普宁市| 周口市| 洪湖市| 颍上县| 翼城县| 区。| 崇州市| 永城市| 泰州市| 合阳县| 湖北省| 桐乡市| 舟曲县| 商丘市| 金堂县| 平罗县| 浑源县| 崇阳县| 明溪县| 桑植县| 荃湾区| 汝阳县| 红桥区|