修改sql联系为sql格式
This commit is contained in:
parent
3e9e8f99c0
commit
c9758d7e72
@ -1,21 +0,0 @@
|
||||
#
|
||||
# A fatal error has been detected by the Java Runtime Environment:
|
||||
#
|
||||
# SIGSEGV (0xb) at pc=0x00007f215cc73133, pid=287213, tid=287228
|
||||
#
|
||||
# JRE version: OpenJDK Runtime Environment (11.0.9+11) (build 11.0.9+11-post-Debian-1)
|
||||
# Java VM: OpenJDK 64-Bit Server VM (11.0.9+11-post-Debian-1, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
|
||||
# Problematic frame:
|
||||
# C [libjimage.so+0x3133]
|
||||
#
|
||||
# Core dump will be written. Default location: /home/zeek/project/leetCode/core
|
||||
#
|
||||
# If you would like to submit a bug report, please visit:
|
||||
# https://bugs.debian.org/openjdk-11
|
||||
#
|
||||
|
||||
--------------- S U M M A R Y ------------
|
||||
|
||||
Command Line: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:43579 -javaagent:/home/zeek/software/eclipse_java/configuration/org.eclipse.osgi/406/0/.cp/lib/javaagent-shaded.jar -Dfile.encoding=UTF-8 -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true com.leetcode.string.Convert2Zstr
|
||||
|
||||
Host:
|
@ -1,4 +1,4 @@
|
||||
## 题目
|
||||
/**
|
||||
某网站包含两个表,Customers 表和 Orders 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。
|
||||
|
||||
Customers 表:
|
||||
@ -31,10 +31,9 @@ Orders 表:
|
||||
| Max |
|
||||
+-----------+
|
||||
```
|
||||
**/
|
||||
|
||||
## 答案
|
||||
```sql
|
||||
select Name as Customers
|
||||
from Customers a
|
||||
where a.id not in (select CustomerId from Orders)
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
## 题目
|
||||
/**
|
||||
编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱。
|
||||
示例:
|
||||
```
|
||||
@ -19,8 +19,7 @@
|
||||
| a@b.com |
|
||||
+---------+
|
||||
```
|
||||
**/
|
||||
|
||||
## 答案
|
||||
```sql
|
||||
select Email from Person group by Email having count(*) > 1
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
## 题目:
|
||||
/**
|
||||
|
||||
Employee 表包含所有员工,他们的经理也属于员工。每个员工都有一个 Id,此外还有一列对应员工的经理的 Id。
|
||||
```
|
||||
@ -22,11 +22,9 @@ Employee 表包含所有员工,他们的经理也属于员工。每个员工
|
||||
| Joe |
|
||||
+----------+
|
||||
```
|
||||
**/
|
||||
|
||||
## 答案
|
||||
|
||||
```sql
|
||||
select a.Name as Employee
|
||||
from Employee a, (select Salary,Id from Employee) b
|
||||
where a.ManagerId=b.Id and a.Salary > b.Salary
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user