Summary of Leetcode-Mysql topics and knowledge points (181. Employees whose income exceeds the manager's income)

Computer Xiaobai QAQ, because I want to find a few summer internships, I have filled the members and want to focus on the mysql part of leetcode. Write this series of blog posts to communicate with you, and we will continue to update some of the prepared questions in the future. Welcome to communicate with you, and ask the big guys to spray QAQ. Because I have taken many detours as a beginner, I will try my best to write in detail. If you can help future friends, please leave a message to encourage me. Hahahaha.

181. Employees who exceed the manager's income

The knowledge points of this topic have been mentioned before, mainly left connection, renaming, and condition filtering. For details, please see the previous blog. It should be noted that after the connection, if the selected column is shared by the two tables, it is necessary to specify which table it is, otherwise an error will be reported due to the vague reference.

The code given is as follows:

select e1.Name as Employee

from Employee as e1

left join Employee as e2

on e1.ManagerId=e2.Id

where e1.Salary>e2.Salary

Guess you like

Origin blog.csdn.net/weixin_43167461/article/details/113139013