1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-13 19:31:42 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

5 Commits

Author SHA1 Message Date
9f09df9544 update 2025-09-02 22:45:58 +08:00
f6b8cd3b4b update 2025-08-10 21:35:14 +08:00
dee13a03bd update 2025-07-17 00:14:36 +08:00
5808ae7d32 update 2025-06-27 15:44:17 +08:00
1e59635fae update 2025-06-18 01:10:28 +08:00
296 changed files with 46812 additions and 11056 deletions

View File

@@ -1,6 +1,6 @@
# 力扣题库(完整版)
> 最后更新日期: **2025.05.25**
> 最后更新日期: **2025.09.02**
>
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,96 @@
{
"data": {
"question": {
"questionId": "596",
"questionFrontendId": "596",
"categoryTitle": "Database",
"boundTopicId": 1418,
"title": "Classes With at Least 5 Students",
"titleSlug": "classes-with-at-least-5-students",
"content": "<p>Table: <code>Courses</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| student | varchar |\n| class | varchar |\n+-------------+---------+\n(student, class) is the primary key (combination of columns with unique values) for this table.\nEach row of this table indicates the name of a student and the class in which they are enrolled.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to find all the classes that have <strong>at least five students</strong>.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The&nbsp;result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nCourses table:\n+---------+----------+\n| student | class |\n+---------+----------+\n| A | Math |\n| B | English |\n| C | Math |\n| D | Biology |\n| E | Math |\n| F | Computer |\n| G | Math |\n| H | Math |\n| I | Math |\n+---------+----------+\n<strong>Output:</strong> \n+---------+\n| class |\n+---------+\n| Math |\n+---------+\n<strong>Explanation:</strong> \n- Math has 6 students, so we include it.\n- English has 1 student, so we do not include it.\n- Biology has 1 student, so we do not include it.\n- Computer has 1 student, so we do not include it.\n</pre>\n",
"translatedTitle": "超过 5 名学生的课",
"translatedContent": "<p>表:&nbsp;<code>Courses</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| student | varchar |\n| class | varchar |\n+-------------+---------+\n(student, class)是该表的主键(不同值的列的组合)。\n该表的每一行表示学生的名字和他们注册的班级。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>查询&nbsp;<strong>至少有 5 个学生</strong> 的所有班级。</p>\n\n<p>以 <strong>任意顺序 </strong>返回结果表。</p>\n\n<p>结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong class=\"example\">示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> \nCourses table:\n+---------+----------+\n| student | class |\n+---------+----------+\n| A | Math |\n| B | English |\n| C | Math |\n| D | Biology |\n| E | Math |\n| F | Computer |\n| G | Math |\n| H | Math |\n| I | Math |\n+---------+----------+\n<strong>输出:</strong> \n+---------+ \n| class &nbsp; | \n+---------+ \n| Math &nbsp; &nbsp;| \n+---------+\n<strong>解释: </strong>\n-数学课有 6 个学生,所以我们包括它。\n-英语课有 1 名学生,所以我们不包括它。\n-生物课有 1 名学生,所以我们不包括它。\n-计算机课有 1 个学生,所以我们不包括它。</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 354,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false, \"cangjie\": false}",
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": "数据库",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef find_classes(courses: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"221.6K\", \"totalSubmission\": \"390.8K\", \"totalAcceptedRaw\": 221606, \"totalSubmissionRaw\": 390792, \"acRate\": \"56.7%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\": {\"Courses\": [\"student\", \"class\"]}, \"rows\": {\"Courses\": [[\"A\", \"Math\"], [\"B\", \"English\"], [\"C\", \"Math\"], [\"D\", \"Biology\"], [\"E\", \"Math\"], [\"F\", \"Computer\"], [\"G\", \"Math\"], [\"H\", \"Math\"], [\"I\", \"Math\"]]}}",
"metaData": "{\"mysql\":[\"Create table If Not Exists Courses (student varchar(255), class varchar(255))\"],\"mssql\":[\"Create table Courses (student varchar(255), class varchar(255))\"],\"oraclesql\":[\"Create table Courses (student varchar(255), class varchar(255))\"],\"database\":true,\"name\":\"find_classes\",\"pythondata\":[\"Courses = pd.DataFrame([], columns=['student', 'class']).astype({'student':'object', 'class':'object'})\"],\"postgresql\":[\"Create table If Not Exists Courses (student varchar(255), class varchar(255))\"],\"database_schema\":{\"Courses\":{\"student\":\"VARCHAR(255)\",\"class\":\"VARCHAR(255)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Courses (student varchar(255), class varchar(255))",
"Truncate table Courses",
"insert into Courses (student, class) values ('A', 'Math')",
"insert into Courses (student, class) values ('B', 'English')",
"insert into Courses (student, class) values ('C', 'Math')",
"insert into Courses (student, class) values ('D', 'Biology')",
"insert into Courses (student, class) values ('E', 'Math')",
"insert into Courses (student, class) values ('F', 'Computer')",
"insert into Courses (student, class) values ('G', 'Math')",
"insert into Courses (student, class) values ('H', 'Math')",
"insert into Courses (student, class) values ('I', 'Math')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\": {\"Courses\": [\"student\", \"class\"]}, \"rows\": {\"Courses\": [[\"A\", \"Math\"], [\"B\", \"English\"], [\"C\", \"Math\"], [\"D\", \"Biology\"], [\"E\", \"Math\"], [\"F\", \"Computer\"], [\"G\", \"Math\"], [\"H\", \"Math\"], [\"I\", \"Math\"]]}}",
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,106 @@
{
"data": {
"question": {
"questionId": "3932",
"questionFrontendId": "3586",
"categoryTitle": "Database",
"boundTopicId": 3701001,
"title": "Find COVID Recovery Patients",
"titleSlug": "find-covid-recovery-patients",
"content": "<p>Table: <code>patients</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| patient_id | int |\n| patient_name| varchar |\n| age | int |\n+-------------+---------+\npatient_id is the unique identifier for this table.\nEach row contains information about a patient.\n</pre>\n\n<p>Table: <code>covid_tests</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| test_id | int |\n| patient_id | int |\n| test_date | date |\n| result | varchar |\n+-------------+---------+\ntest_id is the unique identifier for this table.\nEach row represents a COVID test result. The result can be Positive, Negative, or Inconclusive.\n</pre>\n\n<p>Write a solution to find patients who have <strong>recovered from COVID</strong> - patients who tested positive but later tested negative.</p>\n\n<ul>\n\t<li>A patient is considered recovered if they have <strong>at least one</strong> <strong>Positive</strong> test followed by at least one <strong>Negative</strong> test on a <strong>later date</strong></li>\n\t<li>Calculate the <strong>recovery time</strong> in days as the <strong>difference</strong> between the <strong>first positive test</strong> and the <strong>first negative test</strong> after that <strong>positive test</strong></li>\n\t<li><strong>Only include</strong> patients who have both positive and negative test results</li>\n</ul>\n\n<p>Return <em>the result table ordered by </em><code>recovery_time</code><em> in <strong>ascending</strong> order, then by </em><code>patient_name</code><em> in <strong>ascending</strong> order</em>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong></p>\n\n<p>patients table:</p>\n\n<pre class=\"example-io\">\n+------------+--------------+-----+\n| patient_id | patient_name | age |\n+------------+--------------+-----+\n| 1 | Alice Smith | 28 |\n| 2 | Bob Johnson | 35 |\n| 3 | Carol Davis | 42 |\n| 4 | David Wilson | 31 |\n| 5 | Emma Brown | 29 |\n+------------+--------------+-----+\n</pre>\n\n<p>covid_tests table:</p>\n\n<pre class=\"example-io\">\n+---------+------------+------------+--------------+\n| test_id | patient_id | test_date | result |\n+---------+------------+------------+--------------+\n| 1 | 1 | 2023-01-15 | Positive |\n| 2 | 1 | 2023-01-25 | Negative |\n| 3 | 2 | 2023-02-01 | Positive |\n| 4 | 2 | 2023-02-05 | Inconclusive |\n| 5 | 2 | 2023-02-12 | Negative |\n| 6 | 3 | 2023-01-20 | Negative |\n| 7 | 3 | 2023-02-10 | Positive |\n| 8 | 3 | 2023-02-20 | Negative |\n| 9 | 4 | 2023-01-10 | Positive |\n| 10 | 4 | 2023-01-18 | Positive |\n| 11 | 5 | 2023-02-15 | Negative |\n| 12 | 5 | 2023-02-20 | Negative |\n+---------+------------+------------+--------------+\n</pre>\n\n<p><strong>Output:</strong></p>\n\n<pre class=\"example-io\">\n+------------+--------------+-----+---------------+\n| patient_id | patient_name | age | recovery_time |\n+------------+--------------+-----+---------------+\n| 1 | Alice Smith | 28 | 10 |\n| 3 | Carol Davis | 42 | 10 |\n| 2 | Bob Johnson | 35 | 11 |\n+------------+--------------+-----+---------------+\n</pre>\n\n<p><strong>Explanation:</strong></p>\n\n<ul>\n\t<li><strong>Alice Smith (patient_id = 1):</strong>\n\n\t<ul>\n\t\t<li>First positive test: 2023-01-15</li>\n\t\t<li>First negative test after positive: 2023-01-25</li>\n\t\t<li>Recovery time: 25 - 15 = 10 days</li>\n\t</ul>\n\t</li>\n\t<li><strong>Bob Johnson (patient_id = 2):</strong>\n\t<ul>\n\t\t<li>First positive test: 2023-02-01</li>\n\t\t<li>Inconclusive test on 2023-02-05 (ignored for recovery calculation)</li>\n\t\t<li>First negative test after positive: 2023-02-12</li>\n\t\t<li>Recovery time: 12 - 1 = 11 days</li>\n\t</ul>\n\t</li>\n\t<li><strong>Carol Davis (patient_id = 3):</strong>\n\t<ul>\n\t\t<li>Had negative test on 2023-01-20 (before positive test)</li>\n\t\t<li>First positive test: 2023-02-10</li>\n\t\t<li>First negative test after positive: 2023-02-20</li>\n\t\t<li>Recovery time: 20 - 10 = 10 days</li>\n\t</ul>\n\t</li>\n\t<li><strong>Patients not included:</strong>\n\t<ul>\n\t\t<li>David Wilson (patient_id = 4): Only has positive tests, no negative test after positive</li>\n\t\t<li>Emma Brown (patient_id = 5): Only has negative tests, never tested positive</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>Output table is ordered by recovery_time in ascending order, and then by patient_name in ascending order.</p>\n</div>\n",
"translatedTitle": "寻找 COVID 康复患者",
"translatedContent": "<p>表:<code>patients</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| patient_id | int |\n| patient_name| varchar |\n| age | int |\n+-------------+---------+\npatient_id 是这张表的唯一主键。\n每一行表示一个患者的信息。\n</pre>\n\n<p>表:<code>covid_tests</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| test_id | int |\n| patient_id | int |\n| test_date | date |\n| result | varchar |\n+-------------+---------+\ntest_id 是这张表的唯一主键。\n每一行代表一个 COVID 检测结果。结果可以是阳性、阴性或不确定。\n</pre>\n\n<p>编写一个解决方案以找到从 COVID 中康复的患者——那些曾经检测呈阳性但后来检测呈阴性的患者。</p>\n\n<ul>\n\t<li>患者如果 <strong>至少有一次阳性</strong> 检测结果后,在&nbsp;<strong>之后的日期</strong> 至少有一次 <strong>阴性</strong> 检测结果,则被认为已康复。</li>\n\t<li>计算从 <strong>首次阳性检测</strong> 结果到 <strong>该阳性检测</strong> 后的 <strong>首次阴性检测结果</strong> 之间的 <strong>康复时间</strong>(以天为单位)</li>\n\t<li><strong>仅包括&nbsp;</strong>同时具有阳性及阴性检测结果的患者</li>\n</ul>\n\n<p>返回结果表以<em>&nbsp;</em><code>recovery_time</code><em> </em><strong>升序 </strong>排序,然后以<em>&nbsp;</em><code>patient_name</code><em> </em><strong>升序&nbsp;</strong>排序。</p>\n\n<p>结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong class=\"example\">示例:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>输入:</strong></p>\n\n<p>patients 表:</p>\n\n<pre class=\"example-io\">\n+------------+--------------+-----+\n| patient_id | patient_name | age |\n+------------+--------------+-----+\n| 1 | Alice Smith | 28 |\n| 2 | Bob Johnson | 35 |\n| 3 | Carol Davis | 42 |\n| 4 | David Wilson | 31 |\n| 5 | Emma Brown | 29 |\n+------------+--------------+-----+\n</pre>\n\n<p>covid_tests 表:</p>\n\n<pre class=\"example-io\">\n+---------+------------+------------+--------------+\n| test_id | patient_id | test_date | result |\n+---------+------------+------------+--------------+\n| 1 | 1 | 2023-01-15 | Positive |\n| 2 | 1 | 2023-01-25 | Negative |\n| 3 | 2 | 2023-02-01 | Positive |\n| 4 | 2 | 2023-02-05 | Inconclusive |\n| 5 | 2 | 2023-02-12 | Negative |\n| 6 | 3 | 2023-01-20 | Negative |\n| 7 | 3 | 2023-02-10 | Positive |\n| 8 | 3 | 2023-02-20 | Negative |\n| 9 | 4 | 2023-01-10 | Positive |\n| 10 | 4 | 2023-01-18 | Positive |\n| 11 | 5 | 2023-02-15 | Negative |\n| 12 | 5 | 2023-02-20 | Negative |\n+---------+------------+------------+--------------+\n</pre>\n\n<p><strong>输出:</strong></p>\n\n<pre class=\"example-io\">\n+------------+--------------+-----+---------------+\n| patient_id | patient_name | age | recovery_time |\n+------------+--------------+-----+---------------+\n| 1 | Alice Smith | 28 | 10 |\n| 3 | Carol Davis | 42 | 10 |\n| 2 | Bob Johnson | 35 | 11 |\n+------------+--------------+-----+---------------+\n</pre>\n\n<p><strong>解释:</strong></p>\n\n<ul>\n\t<li><strong>Alice Smith (patient_id = 1):</strong>\n\n\t<ul>\n\t\t<li>首次阳性检测2023-01-15</li>\n\t\t<li>阳性检测后的首次阴性检测2023-01-25</li>\n\t\t<li>康复时间25 - 15 = 10 天</li>\n\t</ul>\n\t</li>\n\t<li><strong>Bob Johnson (patient_id = 2):</strong>\n\t<ul>\n\t\t<li>首次阳性检测2023-02-01</li>\n\t\t<li>测试结果不明确2023-02-05忽略计算康复时间</li>\n\t\t<li>阳性检测后的首次阴性检测2023-02-12</li>\n\t\t<li>康复时间12 - 1 = 11 天</li>\n\t</ul>\n\t</li>\n\t<li><strong>Carol Davis (patient_id = 3):</strong>\n\t<ul>\n\t\t<li>检测呈阴性2023-01-20在阳性检测前</li>\n\t\t<li>首次阳性检测2023-02-10</li>\n\t\t<li>阳性检测后的首次阴性检测2023-02-20</li>\n\t\t<li>康复时间20 - 10 = 10 天</li>\n\t</ul>\n\t</li>\n\t<li><strong>没有包含的患者:</strong>\n\t<ul>\n\t\t<li>David Wilsonpatient_id = 4只有阳性检测之后没有阴性检测。</li>\n\t\t<li>Emma Brownpatient_id = 5只有阴性检测从未有阳性检测。</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>输出表以 recovery_time 升序排序,然后以 patient_name 升序排序。</p>\n</div>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false, \"cangjie\": false}",
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": "数据库",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef find_covid_recovery_patients(patients: pd.DataFrame, covid_tests: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"102\", \"totalSubmission\": \"180\", \"totalAcceptedRaw\": 102, \"totalSubmissionRaw\": 180, \"acRate\": \"56.7%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"patients\":[\"patient_id\",\"patient_name\",\"age\"],\"covid_tests\":[\"test_id\",\"patient_id\",\"test_date\",\"result\"]},\"rows\":{\"patients\":[[1,\"Alice Smith\",28],[2,\"Bob Johnson\",35],[3,\"Carol Davis\",42],[4,\"David Wilson\",31],[5,\"Emma Brown\",29]],\"covid_tests\":[[1,1,\"2023-01-15\",\"Positive\"],[2,1,\"2023-01-25\",\"Negative\"],[3,2,\"2023-02-01\",\"Positive\"],[4,2,\"2023-02-05\",\"Inconclusive\"],[5,2,\"2023-02-12\",\"Negative\"],[6,3,\"2023-01-20\",\"Negative\"],[7,3,\"2023-02-10\",\"Positive\"],[8,3,\"2023-02-20\",\"Negative\"],[9,4,\"2023-01-10\",\"Positive\"],[10,4,\"2023-01-18\",\"Positive\"],[11,5,\"2023-02-15\",\"Negative\"],[12,5,\"2023-02-20\",\"Negative\"]]}}",
"metaData": "{\"mysql\":[\"CREATE TABLE patients (\\n patient_id INT,\\n patient_name VARCHAR(255),\\n age INT\\n)\",\"CREATE TABLE covid_tests (\\n test_id INT,\\n patient_id INT,\\n test_date DATE,\\n result VARCHAR(50)\\n)\"],\"mssql\":[\"CREATE TABLE patients (\\n patient_id INT,\\n patient_name VARCHAR(255),\\n age INT\\n)\",\"CREATE TABLE covid_tests (\\n test_id INT,\\n patient_id INT,\\n test_date DATE,\\n result VARCHAR(50)\\n)\"],\"oraclesql\":[\"CREATE TABLE patients (\\n patient_id NUMBER,\\n patient_name VARCHAR2(255),\\n age NUMBER\\n)\",\"CREATE TABLE covid_tests (\\n test_id NUMBER,\\n patient_id NUMBER,\\n test_date DATE,\\n result VARCHAR2(50)\\n)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"find_covid_recovery_patients\",\"postgresql\":[\"CREATE TABLE patients (\\n patient_id INTEGER,\\n patient_name VARCHAR(255),\\n age INTEGER\\n);\\n\",\"CREATE TABLE covid_tests (\\n test_id INTEGER,\\n patient_id INTEGER,\\n test_date DATE,\\n result VARCHAR(50)\\n);\\n\"],\"pythondata\":[\"patients = pd.DataFrame({\\n 'patient_id': pd.Series(dtype='int'),\\n 'patient_name': pd.Series(dtype='str'),\\n 'age': pd.Series(dtype='int')\\n})\",\"covid_tests = pd.DataFrame({\\n 'test_id': pd.Series(dtype='int'),\\n 'patient_id': pd.Series(dtype='int'),\\n 'test_date': pd.Series(dtype='datetime64[ns]'),\\n 'result': pd.Series(dtype='str')\\n})\"],\"database_schema\":{\"patients\":{\"patient_id\":\"INT\",\"patient_name\":\"VARCHAR(255)\",\"age\":\"INT\"},\"covid_tests\":{\"test_id\":\"INT\",\"patient_id\":\"INT\",\"test_date\":\"DATE\",\"result\":\"VARCHAR(50)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"CREATE TABLE patients (\n patient_id INT,\n patient_name VARCHAR(255),\n age INT\n)",
"CREATE TABLE covid_tests (\n test_id INT,\n patient_id INT,\n test_date DATE,\n result VARCHAR(50)\n)",
"Truncate table patients",
"insert into patients (patient_id, patient_name, age) values ('1', 'Alice Smith', '28')",
"insert into patients (patient_id, patient_name, age) values ('2', 'Bob Johnson', '35')",
"insert into patients (patient_id, patient_name, age) values ('3', 'Carol Davis', '42')",
"insert into patients (patient_id, patient_name, age) values ('4', 'David Wilson', '31')",
"insert into patients (patient_id, patient_name, age) values ('5', 'Emma Brown', '29')",
"Truncate table covid_tests",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('1', '1', '2023-01-15', 'Positive')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('2', '1', '2023-01-25', 'Negative')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('3', '2', '2023-02-01', 'Positive')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('4', '2', '2023-02-05', 'Inconclusive')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('5', '2', '2023-02-12', 'Negative')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('6', '3', '2023-01-20', 'Negative')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('7', '3', '2023-02-10', 'Positive')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('8', '3', '2023-02-20', 'Negative')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('9', '4', '2023-01-10', 'Positive')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('10', '4', '2023-01-18', 'Positive')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('11', '5', '2023-02-15', 'Negative')",
"insert into covid_tests (test_id, patient_id, test_date, result) values ('12', '5', '2023-02-20', 'Negative')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"patients\":[\"patient_id\",\"patient_name\",\"age\"],\"covid_tests\":[\"test_id\",\"patient_id\",\"test_date\",\"result\"]},\"rows\":{\"patients\":[[1,\"Alice Smith\",28],[2,\"Bob Johnson\",35],[3,\"Carol Davis\",42],[4,\"David Wilson\",31],[5,\"Emma Brown\",29]],\"covid_tests\":[[1,1,\"2023-01-15\",\"Positive\"],[2,1,\"2023-01-25\",\"Negative\"],[3,2,\"2023-02-01\",\"Positive\"],[4,2,\"2023-02-05\",\"Inconclusive\"],[5,2,\"2023-02-12\",\"Negative\"],[6,3,\"2023-01-20\",\"Negative\"],[7,3,\"2023-02-10\",\"Positive\"],[8,3,\"2023-02-20\",\"Negative\"],[9,4,\"2023-01-10\",\"Positive\"],[10,4,\"2023-01-18\",\"Positive\"],[11,5,\"2023-02-15\",\"Negative\"],[12,5,\"2023-02-20\",\"Negative\"]]}}",
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,98 @@
{
"data": {
"question": {
"questionId": "4025",
"questionFrontendId": "3657",
"categoryTitle": "Database",
"boundTopicId": 3761718,
"title": "Find Loyal Customers",
"titleSlug": "find-loyal-customers",
"content": "<p>Table: <code>customer_transactions</code></p>\n\n<pre>\n+------------------+---------+\n| Column Name | Type | \n+------------------+---------+\n| transaction_id | int |\n| customer_id | int |\n| transaction_date | date |\n| amount | decimal |\n| transaction_type | varchar |\n+------------------+---------+\ntransaction_id is the unique identifier for this table.\ntransaction_type can be either &#39;purchase&#39; or &#39;refund&#39;.\n</pre>\n\n<p>Write a solution to find <strong>loyal customers</strong>. A customer is considered <strong>loyal</strong> if they meet ALL the following criteria:</p>\n\n<ul>\n\t<li>Made <strong>at least</strong>&nbsp;<code><font face=\"monospace\">3</font></code>&nbsp;purchase transactions.</li>\n\t<li>Have been active for <strong>at least</strong> <code>30</code> days.</li>\n\t<li>Their <strong>refund rate</strong> is less than <code>20%</code> .</li>\n</ul>\n\n<p>Return <em>the result table&nbsp;ordered by</em> <code>customer_id</code> <em>in <strong>ascending</strong> order</em>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong></p>\n\n<p>customer_transactions table:</p>\n\n<pre class=\"example-io\">\n+----------------+-------------+------------------+--------+------------------+\n| transaction_id | customer_id | transaction_date | amount | transaction_type |\n+----------------+-------------+------------------+--------+------------------+\n| 1 | 101 | 2024-01-05 | 150.00 | purchase |\n| 2 | 101 | 2024-01-15 | 200.00 | purchase |\n| 3 | 101 | 2024-02-10 | 180.00 | purchase |\n| 4 | 101 | 2024-02-20 | 250.00 | purchase |\n| 5 | 102 | 2024-01-10 | 100.00 | purchase |\n| 6 | 102 | 2024-01-12 | 120.00 | purchase |\n| 7 | 102 | 2024-01-15 | 80.00 | refund |\n| 8 | 102 | 2024-01-18 | 90.00 | refund |\n| 9 | 102 | 2024-02-15 | 130.00 | purchase |\n| 10 | 103 | 2024-01-01 | 500.00 | purchase |\n| 11 | 103 | 2024-01-02 | 450.00 | purchase |\n| 12 | 103 | 2024-01-03 | 400.00 | purchase |\n| 13 | 104 | 2024-01-01 | 200.00 | purchase |\n| 14 | 104 | 2024-02-01 | 250.00 | purchase |\n| 15 | 104 | 2024-02-15 | 300.00 | purchase |\n| 16 | 104 | 2024-03-01 | 350.00 | purchase |\n| 17 | 104 | 2024-03-10 | 280.00 | purchase |\n| 18 | 104 | 2024-03-15 | 100.00 | refund |\n+----------------+-------------+------------------+--------+------------------+\n</pre>\n\n<p><strong>Output:</strong></p>\n\n<pre class=\"example-io\">\n+-------------+\n| customer_id |\n+-------------+\n| 101 |\n| 104 |\n+-------------+\n</pre>\n\n<p><strong>Explanation:</strong></p>\n\n<ul>\n\t<li><strong>Customer 101</strong>:\n\n\t<ul>\n\t\t<li>Purchase transactions: 4 (IDs: 1, 2, 3, 4)&nbsp;</li>\n\t\t<li>Refund transactions: 0</li>\n\t\t<li>Refund rate: 0/4 = 0% (less than 20%)&nbsp;</li>\n\t\t<li>Active period: Jan 5 to Feb 20 = 46 days (at least 30 days)&nbsp;</li>\n\t\t<li>Qualifies as loyal&nbsp;</li>\n\t</ul>\n\t</li>\n\t<li><strong>Customer 102</strong>:\n\t<ul>\n\t\t<li>Purchase transactions: 3 (IDs: 5, 6, 9)&nbsp;</li>\n\t\t<li>Refund transactions: 2 (IDs: 7, 8)</li>\n\t\t<li>Refund rate: 2/5 = 40% (exceeds 20%)&nbsp;</li>\n\t\t<li>Not loyal&nbsp;</li>\n\t</ul>\n\t</li>\n\t<li><strong>Customer 103</strong>:\n\t<ul>\n\t\t<li>Purchase transactions: 3 (IDs: 10, 11, 12)&nbsp;</li>\n\t\t<li>Refund transactions: 0</li>\n\t\t<li>Refund rate: 0/3 = 0% (less than 20%)&nbsp;</li>\n\t\t<li>Active period: Jan 1 to Jan 3 = 2 days (less than 30 days)&nbsp;</li>\n\t\t<li>Not loyal&nbsp;</li>\n\t</ul>\n\t</li>\n\t<li><strong>Customer 104</strong>:\n\t<ul>\n\t\t<li>Purchase transactions: 5 (IDs: 13, 14, 15, 16, 17)&nbsp;</li>\n\t\t<li>Refund transactions: 1 (ID: 18)</li>\n\t\t<li>Refund rate: 1/6 = 16.67% (less than 20%)&nbsp;</li>\n\t\t<li>Active period: Jan 1 to Mar 15 = 73 days (at least 30 days)&nbsp;</li>\n\t\t<li>Qualifies as loyal&nbsp;</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>The result table is ordered by customer_id in ascending order.</p>\n</div>\n",
"translatedTitle": "寻找忠实客户",
"translatedContent": "<p>表:<code>customer_transactions</code></p>\n\n<pre>\n+------------------+---------+\n| Column Name | Type | \n+------------------+---------+\n| transaction_id | int |\n| customer_id | int |\n| transaction_date | date |\n| amount | decimal |\n| transaction_type | varchar |\n+------------------+---------+\ntransaction_id 是这张表的唯一主键。\ntransaction_type 可以是 “purchase” 或 “refund”。\n</pre>\n\n<p>编写一个解决方案来查找 <strong>忠实客户</strong>。如果满足下述所有条件,可以认为该客户是 <strong>忠实</strong> 客户:</p>\n\n<ul>\n\t<li>进行了 <strong>至少</strong>&nbsp;<code><font face=\"monospace\">3</font></code>&nbsp;次购买交易。</li>\n\t<li>活跃了&nbsp;<strong>至少</strong>&nbsp;<code>30</code>&nbsp;天。</li>\n\t<li>他们的 <strong>退款率</strong>&nbsp;少于&nbsp;<code>20%</code>。</li>\n</ul>\n\n<p>返回结果表以&nbsp;<code>customer_id</code> <strong>升序</strong>&nbsp;排序。</p>\n\n<p>结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong class=\"example\">示例:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>输入:</strong></p>\n\n<p>customer_transactions 表:</p>\n\n<pre class=\"example-io\">\n+----------------+-------------+------------------+--------+------------------+\n| transaction_id | customer_id | transaction_date | amount | transaction_type |\n+----------------+-------------+------------------+--------+------------------+\n| 1 | 101 | 2024-01-05 | 150.00 | purchase |\n| 2 | 101 | 2024-01-15 | 200.00 | purchase |\n| 3 | 101 | 2024-02-10 | 180.00 | purchase |\n| 4 | 101 | 2024-02-20 | 250.00 | purchase |\n| 5 | 102 | 2024-01-10 | 100.00 | purchase |\n| 6 | 102 | 2024-01-12 | 120.00 | purchase |\n| 7 | 102 | 2024-01-15 | 80.00 | refund |\n| 8 | 102 | 2024-01-18 | 90.00 | refund |\n| 9 | 102 | 2024-02-15 | 130.00 | purchase |\n| 10 | 103 | 2024-01-01 | 500.00 | purchase |\n| 11 | 103 | 2024-01-02 | 450.00 | purchase |\n| 12 | 103 | 2024-01-03 | 400.00 | purchase |\n| 13 | 104 | 2024-01-01 | 200.00 | purchase |\n| 14 | 104 | 2024-02-01 | 250.00 | purchase |\n| 15 | 104 | 2024-02-15 | 300.00 | purchase |\n| 16 | 104 | 2024-03-01 | 350.00 | purchase |\n| 17 | 104 | 2024-03-10 | 280.00 | purchase |\n| 18 | 104 | 2024-03-15 | 100.00 | refund |\n+----------------+-------------+------------------+--------+------------------+\n</pre>\n\n<p><strong>输出:</strong></p>\n\n<pre class=\"example-io\">\n+-------------+\n| customer_id |\n+-------------+\n| 101 |\n| 104 |\n+-------------+\n</pre>\n\n<p><strong>解释:</strong></p>\n\n<ul>\n\t<li><strong>客户 101</strong>:\n\n\t<ul>\n\t\t<li>购买交易4 (IDs: 1, 2, 3, 4)&nbsp;</li>\n\t\t<li>退款交易0</li>\n\t\t<li>退款率0/4 = 0%(少于 20%</li>\n\t\t<li>活跃时期1 月&nbsp;5 日到 2 月 20 日 = 46 天(至少 30 天)</li>\n\t\t<li>符合忠诚客户条件</li>\n\t</ul>\n\t</li>\n\t<li><strong>客户 102</strong>:\n\t<ul>\n\t\t<li>购买交易3 (IDs: 5, 6, 9)&nbsp;</li>\n\t\t<li>退款交易2 (IDs: 7, 8)</li>\n\t\t<li>退款率2/5 = 40% (超过&nbsp;20%)&nbsp;</li>\n\t\t<li>不符合忠诚客户条件</li>\n\t</ul>\n\t</li>\n\t<li><strong>客户 103</strong>:\n\t<ul>\n\t\t<li>购买交易3 (IDs: 10, 11, 12)&nbsp;</li>\n\t\t<li>退款交易0</li>\n\t\t<li>退款率0/3 = 0%(少于 20%</li>\n\t\t<li>活跃时期1 月 1 日到 1 月 3 日 =&nbsp;2 天(少于 30 天)</li>\n\t\t<li>不符合忠诚客户条件</li>\n\t</ul>\n\t</li>\n\t<li><strong>客户 104</strong>:\n\t<ul>\n\t\t<li>购买交易5 (IDs: 13, 14, 15, 16, 17)&nbsp;</li>\n\t\t<li>退款交易1 (ID: 18)</li>\n\t\t<li>退款率1/6 = 16.67%(少于 20%</li>\n\t\t<li>活跃时期1 月 1 日到 3 月 15 日 = 73 天(至少 30 天)</li>\n\t\t<li>符合忠诚客户条件</li>\n\t</ul>\n\t</li>\n</ul>\n\n<p>结果表以 customer_id 升序排序。</p>\n</div>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 1,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false, \"cangjie\": false}",
"topicTags": [],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef find_loyal_customers(customer_transactions: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"216\", \"totalSubmission\": \"318\", \"totalAcceptedRaw\": 216, \"totalSubmissionRaw\": 318, \"acRate\": \"67.9%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"customer_transactions\":[\"transaction_id\",\"customer_id\",\"transaction_date\",\"amount\",\"transaction_type\"]},\"rows\":{\"customer_transactions\":[[1,101,\"2024-01-05\",150.00,\"purchase\"],[2,101,\"2024-01-15\",200.00,\"purchase\"],[3,101,\"2024-02-10\",180.00,\"purchase\"],[4,101,\"2024-02-20\",250.00,\"purchase\"],[5,102,\"2024-01-10\",100.00,\"purchase\"],[6,102,\"2024-01-12\",120.00,\"purchase\"],[7,102,\"2024-01-15\",80.00,\"refund\"],[8,102,\"2024-01-18\",90.00,\"refund\"],[9,102,\"2024-02-15\",130.00,\"purchase\"],[10,103,\"2024-01-01\",500.00,\"purchase\"],[11,103,\"2024-01-02\",450.00,\"purchase\"],[12,103,\"2024-01-03\",400.00,\"purchase\"],[13,104,\"2024-01-01\",200.00,\"purchase\"],[14,104,\"2024-02-01\",250.00,\"purchase\"],[15,104,\"2024-02-15\",300.00,\"purchase\"],[16,104,\"2024-03-01\",350.00,\"purchase\"],[17,104,\"2024-03-10\",280.00,\"purchase\"],[18,104,\"2024-03-15\",100.00,\"refund\"]]}}",
"metaData": "{\"mysql\":[\"CREATE TABLE if not exists customer_transactions (\\n transaction_id INT,\\n customer_id INT,\\n transaction_date DATE,\\n amount DECIMAL(10,2),\\n transaction_type VARCHAR(20)\\n)\"],\"mssql\":[\"CREATE TABLE customer_transactions (\\n transaction_id INT,\\n customer_id INT,\\n transaction_date DATE,\\n amount DECIMAL(10,2),\\n transaction_type VARCHAR(20)\\n)\"],\"oraclesql\":[\"CREATE TABLE customer_transactions (\\n transaction_id NUMBER,\\n customer_id NUMBER,\\n transaction_date DATE,\\n amount NUMBER(10,2),\\n transaction_type VARCHAR2(20)\\n)\",\"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"],\"database\":true,\"name\":\"find_loyal_customers\",\"postgresql\":[\"CREATE TABLE IF NOT EXISTS customer_transactions (\\n transaction_id SERIAL PRIMARY KEY,\\n customer_id INT NOT NULL,\\n transaction_date DATE NOT NULL,\\n amount NUMERIC(10,2) NOT NULL,\\n transaction_type VARCHAR(20) NOT NULL\\n);\"],\"pythondata\":[\"customer_transactions = pd.DataFrame({\\n \\\"transaction_id\\\": pd.Series(dtype=\\\"int\\\"),\\n \\\"customer_id\\\": pd.Series(dtype=\\\"int\\\"),\\n \\\"transaction_date\\\": pd.Series(dtype=\\\"datetime64[ns]\\\"),\\n \\\"amount\\\": pd.Series(dtype=\\\"float\\\"),\\n \\\"transaction_type\\\": pd.Series(dtype=\\\"string\\\")\\n})\"],\"database_schema\":{\"customer_transactions\":{\"transaction_id\":\"INT\",\"customer_id\":\"INT\",\"transaction_date\":\"DATE\",\"amount\":\"DECIMAL(10, 2)\",\"transaction_type\":\"VARCHAR(20)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"CREATE TABLE if not exists customer_transactions (\n transaction_id INT,\n customer_id INT,\n transaction_date DATE,\n amount DECIMAL(10,2),\n transaction_type VARCHAR(20)\n)",
"Truncate table customer_transactions",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('1', '101', '2024-01-05', '150.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('2', '101', '2024-01-15', '200.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('3', '101', '2024-02-10', '180.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('4', '101', '2024-02-20', '250.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('5', '102', '2024-01-10', '100.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('6', '102', '2024-01-12', '120.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('7', '102', '2024-01-15', '80.0', 'refund')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('8', '102', '2024-01-18', '90.0', 'refund')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('9', '102', '2024-02-15', '130.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('10', '103', '2024-01-01', '500.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('11', '103', '2024-01-02', '450.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('12', '103', '2024-01-03', '400.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('13', '104', '2024-01-01', '200.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('14', '104', '2024-02-01', '250.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('15', '104', '2024-02-15', '300.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('16', '104', '2024-03-01', '350.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('17', '104', '2024-03-10', '280.0', 'purchase')",
"insert into customer_transactions (transaction_id, customer_id, transaction_date, amount, transaction_type) values ('18', '104', '2024-03-15', '100.0', 'refund')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"customer_transactions\":[\"transaction_id\",\"customer_id\",\"transaction_date\",\"amount\",\"transaction_type\"]},\"rows\":{\"customer_transactions\":[[1,101,\"2024-01-05\",150.00,\"purchase\"],[2,101,\"2024-01-15\",200.00,\"purchase\"],[3,101,\"2024-02-10\",180.00,\"purchase\"],[4,101,\"2024-02-20\",250.00,\"purchase\"],[5,102,\"2024-01-10\",100.00,\"purchase\"],[6,102,\"2024-01-12\",120.00,\"purchase\"],[7,102,\"2024-01-15\",80.00,\"refund\"],[8,102,\"2024-01-18\",90.00,\"refund\"],[9,102,\"2024-02-15\",130.00,\"purchase\"],[10,103,\"2024-01-01\",500.00,\"purchase\"],[11,103,\"2024-01-02\",450.00,\"purchase\"],[12,103,\"2024-01-03\",400.00,\"purchase\"],[13,104,\"2024-01-01\",200.00,\"purchase\"],[14,104,\"2024-02-01\",250.00,\"purchase\"],[15,104,\"2024-02-15\",300.00,\"purchase\"],[16,104,\"2024-03-01\",350.00,\"purchase\"],[17,104,\"2024-03-10\",280.00,\"purchase\"],[18,104,\"2024-03-15\",100.00,\"refund\"]]}}",
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More