当前位置:Gxlcms > 数据库问题 > 【leetcode】SQL相关的题目

【leetcode】SQL相关的题目

时间:2021-07-01 10:21:17 帮助过:3人阅读

 

推荐好书:SQL必知必会。靠这本书入了个门

 

以下均为MYSQL方式提交

 

Duplicate Emails

select Email from Person 
group by email
having count(*) >1

 

Employees Earning More Than Their Managers

select E1.name as Employee
from Employee as E1,Employee as E2
where E1.ManagerID=E2.Id and E1.Salary>E2.Salary

 

Combine Two Tables

select FirstName,LastName,City,State from Person
left join Address on Person.PersonId=Address.PersonId;

 

Customers Who Never Order

select name as Customers from Customers C
where C.Id not in (select CustomerID from Orders);

 

【leetcode】SQL相关的题目

标签:

人气教程排行