mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
34 lines
661 B
HTML
34 lines
661 B
HTML
<p>某网站包含两个表,<code>Customers</code> 表和 <code>Orders</code> 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。</p>
|
|
|
|
<p><code>Customers</code> 表:</p>
|
|
|
|
<pre>+----+-------+
|
|
| Id | Name |
|
|
+----+-------+
|
|
| 1 | Joe |
|
|
| 2 | Henry |
|
|
| 3 | Sam |
|
|
| 4 | Max |
|
|
+----+-------+
|
|
</pre>
|
|
|
|
<p><code>Orders</code> 表:</p>
|
|
|
|
<pre>+----+------------+
|
|
| Id | CustomerId |
|
|
+----+------------+
|
|
| 1 | 3 |
|
|
| 2 | 1 |
|
|
+----+------------+
|
|
</pre>
|
|
|
|
<p>例如给定上述表格,你的查询应返回:</p>
|
|
|
|
<pre>+-----------+
|
|
| Customers |
|
|
+-----------+
|
|
| Henry |
|
|
| Max |
|
|
+-----------+
|
|
</pre>
|