Рет қаралды 881
Question: leetcode.com/p...
SQL Schema:
Create table If Not Exists Employees (employee_id int, needed_hours int)
Create table If Not Exists Logs (employee_id int, in_time datetime, out_time datetime)
Truncate table Employees
insert into Employees (employee_id, needed_hours) values ('1', '20')
insert into Employees (employee_id, needed_hours) values ('2', '12')
insert into Employees (employee_id, needed_hours) values ('3', '2')
Truncate table Logs
insert into Logs (employee_id, in_time, out_time) values ('1', '2022-10-01 09:00:00', '2022-10-01 17:00:00')
insert into Logs (employee_id, in_time, out_time) values ('1', '2022-10-06 09:05:04', '2022-10-06 17:09:03')
insert into Logs (employee_id, in_time, out_time) values ('1', '2022-10-12 23:00:00', '2022-10-13 03:00:01')
insert into Logs (employee_id, in_time, out_time) values ('2', '2022-10-29 12:00:00', '2022-10-29 23:58:58')
In this video I solve and explain a medium difficulty leetcode SQL question using MySQL query. This question has been asked in Apple, Facebook, Amazon, Google, Adobe, Microsoft, Adobe interviews or what we popularly call FAANG interviews.
I explain the related concept as well. This question includes points to keep in mind to develop SQL queries.
LeetCode is the best platform to help you enhance your skills, expand your knowledge and prepare for technical interviews.
If you found this helpful, Like and Subscribe to the channel for more content.
#LeetCodeSQL #FAANG #SQLinterviewQuestions