Hey. I'm totally new to SQL and I'm trying to get certified. I'm on a test now and the question doesn't appear to make any sense:
"Retrieve a list with the managers last name, and the last name of the employees who report to him or her."
The Tables referenced are:
Obviously I can go anywhere and find the answer, but I'm trying to understand this one.
The answer is supposedly:
select a.LastName as EmployeeLast,a.ReportsTo,b.LastName as ManagerLast
from Employees as a
left join Employees as b
on a.ReportsTo=b.EmployeeId
where b.LastName like "Mitchell"
My question is, there is only an Employees table. There is only a "Reports to" column in that table. So how the heck are they pulling this information to get the answer? How does it make sense?
My best guess is the "Reports to" is some sort of code that is able to link the last name to a manager position... but still, how do they expect totally new people to understand that?
I didn't think learning SQL would be easy, but I was hoping these online courses on Coursera would be a bit more helpful in explaining SQL... so far I've learned more about it just freely researching it all myself.
Thanks for any insight!