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

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -1,20 +1,23 @@
<p>表: <code>Users</code></p>
<pre>+--------------+---------+
<pre>
+--------------+---------+
| Column Name | Type |
+--------------+---------+
| account | int |
| name | varchar |
+--------------+---------+
account 是该表的主键.
的每一行包含银行中每个用户的账号.
account 是该表的主键(具有唯一值的列)。
表的每一行包含银行中每个用户的帐号。
表中不会有两个用户具有相同的名称。
</pre>
<p>&nbsp;</p>
<p>表: <code>Transactions</code></p>
<pre>+---------------+---------+
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| trans_id | int |
@@ -22,23 +25,27 @@ account 是该表的主键.
| amount | int |
| transacted_on | date |
+---------------+---------+
trans_id 是该表主键.
该表的每一行包含了所有账户的交易改变情况.
如果用户收到了钱, 那么金额是正的; 如果用户转了钱, 那么金额是负的.
所有账户的起始余额为 0.
trans_id 是该表主键(具有唯一值的列)。
该表的每一行包含了所有账户的交易改变情况
如果用户收到了钱, 那么金额是正的; 如果用户转了钱, 那么金额是负的
所有账户的起始余额为 0
</pre>
<p>&nbsp;</p>
<p>写一个 SQL,&nbsp;&nbsp;报告余额高于 10000 的所有用户的名字和余额.&nbsp;账户的余额等于包含该账户的所有交易的总和.</p>
<p>编写解决方案,&nbsp;&nbsp;报告余额高于 10000 的所有用户的名字和余额.&nbsp;账户的余额等于包含该账户的所有交易的总和</p>
<p>返回结果表单没有顺序要求.</p>
<p>返回结果表单 <strong>无顺序要求</strong></p>
<p>查询结果格式如下例所示.</p>
<p>查询结果格式如下例所示</p>
<p>&nbsp;</p>
<pre><code>Users</code> table:
<p><strong>示例 1</strong></p>
<pre>
<code><strong>输入:</strong>
Users</code> table:
+------------+--------------+
| account | name |
+------------+--------------+
@@ -59,13 +66,13 @@ trans_id 是该表主键.
| 6 | 900003 | 6000 | 2020-09-07 |
| 7 | 900003 | -4000 | 2020-09-11 |
+------------+------------+------------+---------------+
Result table:
<strong>输出:</strong>
+------------+------------+
| <code>name </code> | <code>balance </code> |
+------------+------------+
| Alice | 11000 |
+------------+------------+
<strong>解释:</strong>
Alice 的余额为(7000 + 7000 - 3000) = 11000.
Bob 的余额为1000.
Charlie 的余额为(6000 + 6000 - 4000) = 8000.