Leetcode Hard 1225: Find Continuous Dates META Advanced SQL Data Science Interview Question Solved!

  Рет қаралды 1,687

Everyday Data Science

Everyday Data Science

Күн бұрын

Welcome to this episode of our groundbreaking series designed to take your SQL skills to the next level! In this series, we're tackling 50 of the most challenging and insightful interview questions on #advanced SQL, aimed at transforming you from an intermediate user to a bona fide #sql expert. Whether you're preparing for a job #interview , seeking to enhance your data manipulation capabilities, or simply passionate about mastering the complexities of SQL, this series is your ultimate roadmap.
Question 44: • Microsoft Asked This A...
SQL 50 Playlist: • SQL 50
Question: leetcode.com/p...
SQL Schema:
Create table If Not Exists Failed (fail_date date)
Create table If Not Exists Succeeded (success_date date)
Truncate table Failed
insert into Failed (fail_date) values ('2018-12-28')
insert into Failed (fail_date) values ('2018-12-29')
insert into Failed (fail_date) values ('2019-01-04')
insert into Failed (fail_date) values ('2019-01-05')
Truncate table Succeeded
insert into Succeeded (success_date) values ('2018-12-30')
insert into Succeeded (success_date) values ('2018-12-31')
insert into Succeeded (success_date) values ('2019-01-01')
insert into Succeeded (success_date) values ('2019-01-02')
insert into Succeeded (success_date) values ('2019-01-03')
insert into Succeeded (success_date) values ('2019-01-06')
Pandas Schema:
data = [['2018-12-28'], ['2018-12-29'], ['2019-01-04'], ['2019-01-05']]
failed = pd.DataFrame(data, columns=['fail_date']).astype({'fail_date':'datetime64[ns]'})
data = [['2018-12-30'], ['2018-12-31'], ['2019-01-01'], ['2019-01-02'], ['2019-01-03'], ['2019-01-06']]
succeeded = pd.DataFrame(data, columns=['success_date']).astype({'success_date':'datetime64[ns]'})
What to Expect:
Detailed Explanations: We don't just solve the question; we dissect it. You'll understand not only the 'how' but also the 'why' behind each solution, ensuring you can apply these principles to a variety of SQL challenges.
Step-by-Step Approach: Our tutorials are designed to be easy to follow.
Real-World Applications: These aren't just theoretical exercises. Each question is selected for its relevance to real-world SQL problems, ensuring you gain practical skills that you can apply in a professional setting.
Why This Series?
SQL remains one of the most in-demand skills in the tech industry, and for a good reason. It's the backbone of data analysis, database management, and many forms of programming. As data continues to drive decision-making in businesses worldwide, the ability to manipulate and retrieve data efficiently becomes increasingly valuable. This series is designed to equip you with these skills, ensuring you're not just ready for your next job interview but also prepared to tackle real-world data challenges.
Who Should Watch?
Intermediate SQL users looking to advance their skills.
Job seekers preparing for technical interviews.
Data professionals seeking to deepen their understanding of SQL.
Anyone with a passion for data to learn.

Пікірлер
@anuragshrivastava7855
@anuragshrivastava7855 5 ай бұрын
bdiya bhai
@xiamojq621
@xiamojq621 10 ай бұрын
thank bro
@EverydayDataScience
@EverydayDataScience 10 ай бұрын
Glad that you found the video useful 😊
@roymou5856
@roymou5856 10 ай бұрын
awesome, thanks. i was thinking we can filter out unwanted dates at the very beginning itself: with cte as ( select * from ( select fail_date as dateState, 'failed' as state from Failed union select success_date as dateState, 'succeeded' as state from Succeeded ) t where dateState between '2019-01-01' and '2019-12-31' order by dateState ), rnkDate as ( select dateState, state, rank() over (partition by state order by dateState) as rnkDate from cte ), grpMarker as ( select *, date_sub(dateState,interval rnkDate DAY) as grpMarker from rnkDate ) select state as period_state , min(dateState) as start_date , max(dateState) as end_date from grpMarker group by grpMarker, state
@EverydayDataScience
@EverydayDataScience 10 ай бұрын
Yes, filtering early in real-world problems especially when dealing with millions of rows is usually a better option. Since I was trying to demonstrate the concept, I filtered it at the very end.
@roymou5856
@roymou5856 10 ай бұрын
@@EverydayDataScience thank you making all these videos. it helped me a lot gaining my confidence to attempt writing medium and hard SQL. Great job. Please share more videoa and help us learning the key concepts.
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
Learn SQL In 60 Minutes
56:24
Web Dev Simplified
Рет қаралды 2,2 МЛН
Querying 100 Billion Rows using SQL, 7 TB in a single table
9:07
Arpit Agrawal (Elastiq.AI)
Рет қаралды 60 М.
Learn 12 Basic SQL Concepts in 15 Minutes (project files included!)
16:48
Why You Should Become a Data Analyst and NOT a Data Scientist
7:01
Sundas Khalid
Рет қаралды 378 М.
SQL Tutorial for Beginners
44:57
Kevin Stratvert
Рет қаралды 2,3 МЛН
Caleb Pressley Shows TSA How It’s Done
0:28
Barstool Sports
Рет қаралды 60 МЛН