SQL leetcode 刷题答案(二)

承接上篇 SQL leetcode 刷题答案https://blog.csdn.net/hahaha66888/article/details/89925981

5、Big Countries

select name,population,area 
from World 
where area > 3000000 or population > 25000000

6、Employees Earning More Than Their Managers

select e1.Name Employee from Employee e1,Employee e2 where e1.ManagerId = e2.Id and e1.Salary > e2.Salary

7、Delete Duplicate Emails

delete t1 from Person t1 ,Person t2
where t1.Email = t2.Email and t1.Id > t2.Id 

8、Swap Salary

update salary set sex = if(sex = 'm','f','m')

 

你可能感兴趣的:(SQL)