Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions solution/0100-0199/0176.Second Highest Salary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
| id | int |
| salary | int |
+-------------+------+
id 是这个表的主键。
在 SQL 中,id 是这个表的主键。
表的每一行包含员工的工资信息。
</pre>

<p>&nbsp;</p>

<p>编写一个 SQL 查询,获取并返回 <code>Employee</code>&nbsp;表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 <code>null</code> 。</p>
<p>查询并返回 <code>Employee</code>&nbsp;表中第二高的薪水 。如果不存在第二高的薪水,查询应该返回 <code>null(Pandas 则返回 None)</code> 。</p>

<p>查询结果如下例所示。</p>

Expand Down
4 changes: 2 additions & 2 deletions solution/0100-0199/0176.Second Highest Salary/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
| id | int |
| salary | int |
+-------------+------+
id is the primary key column for this table.
In SQL, id is the primary key column for this table.
Each row of this table contains information about the salary of an employee.
</pre>

<p>&nbsp;</p>

<p>Find&nbsp;the second highest salary from the <code>Employee</code> table. If there is no second highest salary,&nbsp;return&nbsp;<code>null</code>.</p>
<p>Find&nbsp;the second highest salary from the <code>Employee</code> table. If there is no second highest salary,&nbsp;return&nbsp;<code>null (return&nbsp;None in Pandas)</code>.</p>

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

Expand Down
4 changes: 2 additions & 2 deletions solution/0100-0199/0177.Nth Highest Salary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
| id | int |
| salary | int |
+-------------+------+
Id是该表的主键列
在 SQL 中,id 是该表的主键
该表的每一行都包含有关员工工资的信息。
</pre>

<p>&nbsp;</p>

<p>编写一个SQL查询来报告 <code>Employee</code> 表中第 <code>n</code> 高的工资。如果没有第 <code>n</code> 个最高工资,查询应该报告为&nbsp;<code>null</code> 。</p>
<p>查询&nbsp;<code>Employee</code> 表中第 <code>n</code> 高的工资。如果没有第 <code>n</code> 个最高工资,查询结果应该为&nbsp;<code>null</code> 。</p>

<p>查询结果格式如下所示。</p>

Expand Down
2 changes: 1 addition & 1 deletion solution/0100-0199/0177.Nth Highest Salary/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| id | int |
| salary | int |
+-------------+------+
id is the primary key column for this table.
In SQL, id is the primary key column for this table.
Each row of this table contains information about the salary of an employee.
</pre>

Expand Down
6 changes: 3 additions & 3 deletions solution/0100-0199/0178.Rank Scores/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
| id | int |
| score | decimal |
+-------------+---------+
Id是该表的主键
该表的每一行都包含了一场比赛的分数。Score是一个有两位小数点的浮点值
在 SQL 中,id 是该表的主键
该表的每一行都包含了一场比赛的分数。Score 是一个有两位小数点的浮点值
</pre>

<p>&nbsp;</p>

<p>编写 SQL 查询对分数进行排序。排名按以下规则计算:</p>
<p>查询并对分数进行排序。排名按以下规则计算:</p>

<ul>
<li>分数应按从高到低排列。</li>
Expand Down
2 changes: 1 addition & 1 deletion solution/0100-0199/0178.Rank Scores/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| id | int |
| score | decimal |
+-------------+---------+
id is the primary key for this table.
In SQL, id is the primary key for this table.
Each row of this table contains the score of a game. Score is a floating point value with two decimal places.
</pre>

Expand Down
63 changes: 46 additions & 17 deletions solution/0100-0199/0183.Customers Who Never Order/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,68 @@

<!-- 这里写题目描述 -->

<p>某网站包含两个表,<code>Customers</code> 表和 <code>Orders</code> 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。</p>

<p><code>Customers</code> 表:</p>

<pre>+----+-------+
| Id | Name |
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| name | varchar |
+-------------+---------+
在 SQL 中,id 是该表的主键。
该表的每一行都表示客户的 ID 和名称。</pre>

<p><code>Orders</code> 表:</p>

<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| id | int |
| customerId | int |
+-------------+------+
在 SQL 中,id 是该表的主键。
customerId 是 Customers 表中 ID 的外键( Pandas 中的连接键)。
该表的每一行都表示订单的 ID 和订购该订单的客户的 ID。</pre>

<p>&nbsp;</p>

<p>找出所有从不点任何东西的顾客。</p>

<p>以 <strong>任意顺序</strong> 返回结果表。</p>

<p>结果格式如下所示。</p>

<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>

<pre>
<b>输入:</b>
Customers table:
+----+-------+
| id | name |
+----+-------+
| 1 | Joe |
| 2 | Henry |
| 3 | Sam |
| 4 | Max |
+----+-------+
</pre>

<p><code>Orders</code> 表:</p>

<pre>+----+------------+
| Id | CustomerId |
Orders table:
+----+------------+
| id | customerId |
+----+------------+
| 1 | 3 |
| 2 | 1 |
+----+------------+
</pre>

<p>例如给定上述表格,你的查询应返回:</p>

<pre>+-----------+
<b>输出:</b>
+-----------+
| Customers |
+-----------+
| Henry |
| Max |
+-----------+
</pre>
+-----------+</pre>

## 解法

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| id | int |
| name | varchar |
+-------------+---------+
id is the primary key column for this table.
In SQL, id is the primary key column for this table.
Each row of this table indicates the ID and name of a customer.
</pre>

Expand All @@ -28,8 +28,8 @@ Each row of this table indicates the ID and name of a customer.
| id | int |
| customerId | int |
+-------------+------+
id is the primary key column for this table.
customerId is a foreign key of the ID from the Customers table.
In SQL, id is the primary key column for this table.
customerId is a foreign key (join key in Pandas) of the ID from the Customers table.
Each row of this table indicates the ID of an order and the ID of the customer who ordered it.
</pre>

Expand Down
12 changes: 6 additions & 6 deletions solution/0100-0199/0184.Department Highest Salary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
| salary | int |
| departmentId | int |
+--------------+---------+
id是此表的主键列
departmentId是Department表中ID的外键
此表的每一行都表示员工的ID、姓名和工资。它还包含他们所在部门的ID
在 SQL 中,id是此表的主键
departmentId 是 Department 表中 id 的外键(在 Pandas 中称为 join key)
此表的每一行都表示员工的 id、姓名和工资。它还包含他们所在部门的 id
</pre>

<p>&nbsp;</p>
Expand All @@ -33,13 +33,13 @@ departmentId是Department表中ID的外键。
| id | int |
| name | varchar |
+-------------+---------+
id是此表的主键列
此表的每一行都表示一个部门的ID及其名称
在 SQL 中,id 是此表的主键列
此表的每一行都表示一个部门的 id 及其名称
</pre>

<p>&nbsp;</p>

<p>编写SQL查询以查找每个部门中薪资最高的员工。<br />
<p>查找出每个部门中薪资最高的员工。<br />
按 <strong>任意顺序</strong> 返回结果表。<br />
查询结果格式如下例所示。</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
| salary | int |
| departmentId | int |
+--------------+---------+
id is the primary key column for this table.
departmentId is a foreign key of the ID from the <code>Department </code>table.
In SQL, id is the primary key column for this table.
departmentId is a foreign key (join key in Pandas) of the ID from the <code>Department </code>table.
Each row of this table indicates the ID, name, and salary of an employee. It also contains the ID of their department.
</pre>

Expand All @@ -31,7 +31,7 @@ Each row of this table indicates the ID, name, and salary of an employee. It als
| id | int |
| name | varchar |
+-------------+---------+
id is the primary key column for this table. It is guaranteed that department name is not <code>NULL.</code>
In SQL, id is the primary key column for this table. It is guaranteed that department name is not <code>NULL.</code>
Each row of this table indicates the ID of a department and its name.
</pre>

Expand Down
2 changes: 1 addition & 1 deletion solution/0100-0199/0196.Delete Duplicate Emails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| id | int |
| email | varchar |
+-------------+---------+
id是该表的主键列
在 SQL 中,id 是该表的主键列
该表的每一行包含一封电子邮件。电子邮件将不包含大写字母。
</pre>

Expand Down
6 changes: 3 additions & 3 deletions solution/0100-0199/0196.Delete Duplicate Emails/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
| id | int |
| email | varchar |
+-------------+---------+
id is the primary key column for this table.
In SQL, id is the primary key column for this table.
Each row of this table contains an email. The emails will not contain uppercase letters.
</pre>

<p>&nbsp;</p>

<p><strong>Delete</strong> all the duplicate emails, keeping only one unique email with the smallest <code>id</code>.</p>

<p>(For SQL users, please note that you are supposed to write a <code>DELETE</code> statement and not a <code>SELECT</code> one.)</p>
<p>For SQL users, please note that you are supposed to write a <code>DELETE</code> statement and not a <code>SELECT</code> one.</p>

<p>(For Pandas users, please note that you are supposed to modify <code>Person</code> in place.)</p>
<p>For Pandas users, please note that you are supposed to modify <code>Person</code> in place.</p>

<p>After running your script, the answer shown is the <code>Person</code> table. The driver will first compile and run your piece of code and then show the <code>Person</code> table. The final order of the <code>Person</code> table <strong>does not matter</strong>.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

<!-- 这里写题目描述 -->

<p>给你一个字符串 <code>s</code> 和一个整数 <code>k</code> ,请你找出 <code>s</code> 中的最长子串, 要求该子串中的每一字符出现次数都不少于 <code>k</code> 。返回这一子串的长度。</p>
<p>给你一个字符串 <code>s</code> 和一个整数 <code>k</code> ,请你找出 <code>s</code> 中的最长子串,&nbsp;要求该子串中的每一字符出现次数都不少于 <code>k</code> 。返回这一子串的长度。</p>

<p> </p>
<p data-pm-slice="1 1 []">如果不存在这样的子字符串,则返回 0。</p>

<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>

Expand All @@ -25,14 +27,14 @@
<strong>输出:</strong>5
<strong>解释:</strong>最长子串为 "ababb" ,其中 'a' 重复了 2 次, 'b' 重复了 3 次。</pre>

<p> </p>
<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ul>
<li><code>1 <= s.length <= 10<sup>4</sup></code></li>
<li><code>1 &lt;= s.length &lt;= 10<sup>4</sup></code></li>
<li><code>s</code> 仅由小写英文字母组成</li>
<li><code>1 <= k <= 10<sup>5</sup></code></li>
<li><code>1 &lt;= k &lt;= 10<sup>5</sup></code></li>
</ul>

## 解法
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

<p>Given a string <code>s</code> and an integer <code>k</code>, return <em>the length of the longest substring of</em> <code>s</code> <em>such that the frequency of each character in this substring is greater than or equal to</em> <code>k</code>.</p>

<p data-pm-slice="1 1 []">if no such substring exists, return 0.</p>

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

Expand Down
4 changes: 2 additions & 2 deletions solution/0500-0599/0511.Game Play Analysis I/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
| event_date | date |
| games_played | int |
+--------------+---------+
表的主键是 (player_id, event_date)。
在 SQL 中,表的主键是 (player_id, event_date)。
这张表展示了一些游戏玩家在游戏平台上的行为活动。
每行数据记录了一名玩家在退出平台之前,当天使用同一台设备登录平台后打开的游戏的数目(可能是 0 个)。
</pre>

<p>&nbsp;</p>

<p>写一条 SQL&nbsp;查询语句获取每位玩家 <strong>第一次登陆平台的日期</strong>。</p>
<p>查询每位玩家 <strong>第一次登陆平台的日期</strong>。</p>

<p>查询结果的格式如下所示:</p>

Expand Down
2 changes: 1 addition & 1 deletion solution/0500-0599/0511.Game Play Analysis I/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| event_date | date |
| games_played | int |
+--------------+---------+
(player_id, event_date) is the primary key of this table.
In SQL, (player_id, event_date) is the primary key of this table.
This table shows the activity of players of some games.
Each row is a record of a player who logged in and played a number of games (possibly 0) before logging out on someday using some device.
</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
| department | varchar |
| managerId | int |
+-------------+---------+
Id是该表的主键列
在 SQL 中,id 是该表的主键列
该表的每一行都表示雇员的名字、他们的部门和他们的经理的id。
如果managerId为空,则该员工没有经理。
没有员工会成为自己的管理者。
</pre>

<p>&nbsp;</p>

<p>编写一个SQL查询,查询<strong>至少有5名直接下属</strong>的经理<strong> </strong>。</p>
<p>查询<strong>至少有5名直接下属</strong>的经理<strong> </strong>。</p>

<p>以 <strong>任意顺序 </strong>返回结果表。</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| department | varchar |
| managerId | int |
+-------------+---------+
id is the primary key column for this table.
In SQL, id is the primary key column for this table.
Each row of this table indicates the name of an employee, their department, and the id of their manager.
If managerId is null, then the employee does not have a manager.
No employee will be the manager of themself.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
| order_number | int |
| customer_number | int |
+-----------------+----------+
Order_number是该表的主键。
在 SQL 中,Order_number是该表的主键。
此表包含关于订单ID和客户ID的信息。
</pre>

<p>&nbsp;</p>

<p>编写一个SQL查询,为下了 <strong>最多订单</strong> 的客户查找 <code>customer_number</code> 。</p>
<p>查找下了 <strong>最多订单</strong>&nbsp;的客户的 <code>customer_number</code> 。</p>

<p>测试用例生成后, <strong>恰好有一个客户</strong> 比任何其他客户下了更多的订单。</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| order_number | int |
| customer_number | int |
+-----------------+----------+
order_number is the primary key for this table.
In SQL, order_number is the primary key for this table.
This table contains information about the order ID and the customer ID.
</pre>

Expand Down
Loading