LeetCode 181: Employees Earning More Than Their Managers [SQL]

  Рет қаралды 15,039

Frederik Müller

Frederik Müller

Күн бұрын

Пікірлер
@abinayen
@abinayen 2 жыл бұрын
really helping me study, thank you for all the clear explanations!
@shivambaghel9668
@shivambaghel9668 2 жыл бұрын
you deserves more likes and subscribes
@rudrapriyan5162
@rudrapriyan5162 8 ай бұрын
Do you think if we EXISTS it would reduce the time complexity or the number of tuples it has to olerate on ?
@vgaurav3011
@vgaurav3011 4 жыл бұрын
Nice explanation, loved it!
@VedPrakashLearnToGrow
@VedPrakashLearnToGrow 3 жыл бұрын
Awesome Explanation, Thank you
@zeeshanali271
@zeeshanali271 2 жыл бұрын
I still don't understand the ON clause position statement
@rachcastellino
@rachcastellino 4 жыл бұрын
when you are matching on managerID and ID, why does it pair together ID's that aren't the same value? is this supposed to create all combinations of employees?
@frederikmuller
@frederikmuller 4 жыл бұрын
the join takes the ManagerId of a row and looks for a matching (regular) Id. it seems like you mixed up ManagerId and Id. take a look at the output at 4:21 to see how the 4th and 5th column always match. managers also have a regular Id which can't match the regular Id of another employee since these Ids are unique. hope this helps :)
@angelalu3855
@angelalu3855 2 жыл бұрын
very useful! thanks a lot!
@yueleji8892
@yueleji8892 3 жыл бұрын
could you explain the difference between using ' on and' and 'where' in left join? for example leetcode 577? Thank you!
@frederikmuller
@frederikmuller 3 жыл бұрын
good idea for an upcoming video!
@semantosaini9600
@semantosaini9600 3 жыл бұрын
why in the on clause it is e1.managerid=e2.id and not e1.id=e2.managerid?
@vinoddiwan5792
@vinoddiwan5792 2 жыл бұрын
because from e1 table first we need to find if its manager exists or not . If exists then match from main table e.i id . So, e1.manager id id the foreign key because we need to first find if it exists in other table or not.
@ThereIsPowerInTheBloodOfJesus7
@ThereIsPowerInTheBloodOfJesus7 Жыл бұрын
Is this still in SQL?
@TheProximator
@TheProximator 3 жыл бұрын
Nice, thanks a lot :)
@frederikmuller
@frederikmuller 3 жыл бұрын
You're welcome!
@mickyman753
@mickyman753 2 жыл бұрын
I wrote it like this , don't know why that join doesn't click when I'm doing problems , although I'm doing the same thing select e1.name as Employee from Employee e1 where e1.salary>(select e2.salary from Employee e2 where e2.id=e1.ManagerId);
@avahome5285
@avahome5285 3 жыл бұрын
self join to get the employee's salary and the manager's salary in a row.
@mritunzaysingh8978
@mritunzaysingh8978 2 жыл бұрын
create table employee (id int not null PRIMARY key, name varchar(20), salary int, managerid int ); insert into employee VALUES(1,'JOE',7000,3),(2,'MARRY',8000,4),(3,'SAM',6000,NULL),(4,'MAX',9000,NULL); select * from employee; select E.name,E.salary as emp_salary,M.salary as manager_salary from employee as E join employee as M on E.managerid = M.id where E.salary > M.salary; select E.name as emp_name from employee as E join employee as M on E.managerid = M.id where E.salary > M.salary;
@alibhaiacademy2981
@alibhaiacademy2981 3 жыл бұрын
Thanks, my solution SELECT name AS "Employee" FROM employee e WHERE managerid IN ( SELECT id FROM employee m WHERE e.salary > m.salary
@Games-hearty
@Games-hearty 15 күн бұрын
Do you know what you're doing. You are getting Incorrect. My Favourite Python Teacher is Neetcode Io. But he doesn't upload any advanced videos. So I have no choice but to listen to you. But Anyways Good Work.
@frederikmuller
@frederikmuller 15 күн бұрын
I‘m running partial solutions which is why they will often be marked as incorrect until the final submission.
@arnabpersonal6729
@arnabpersonal6729 3 жыл бұрын
I see u like white a lot
@frederikmuller
@frederikmuller 3 жыл бұрын
yeah
LeetCode 182: Duplicate Emails [3 Solutions]
11:49
Frederik Müller
Рет қаралды 10 М.
ВЛОГ ДИАНА В ТУРЦИИ
1:31:22
Lady Diana VLOG
Рет қаралды 1,2 МЛН
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
LeetCode 176: Second Highest Salary [SQL]
7:19
Frederik Müller
Рет қаралды 20 М.
[MySQL] Leetcode 181. Employees Earning More Than Their Managers [SQL #3]
5:39
LeetCode 197: Rising Temperature [SQL]
8:20
Frederik Müller
Рет қаралды 20 М.
The Only Database Abstraction You Need | Prime Reacts
21:42
ThePrimeTime
Рет қаралды 232 М.
you need to learn SQL RIGHT NOW!! (SQL Tutorial for Beginners)
24:25
NetworkChuck
Рет қаралды 1,6 МЛН
How I Got Good at Coding Interviews
6:29
NeetCode
Рет қаралды 1,7 МЛН