Solving an SQL Interview Problem

preview_player
Показать описание
In this video, let's solve an SQL interview query taken from LeetCode.
The problem might seem complex at first but there is a very simple solution to solve such problems so lets explore it in this video.

Рекомендации по теме
Комментарии
Автор

I have experienced more than one occasions having hard time understanding what the questions are trying to ask. Then after seeing the solution, then understand the questions.

TY-zlvw
Автор

Select id,
Case when p_id is null then "Root"
When id not in (select distinct p_id from tree) then "Leaf"
Else "Inner"
End as type
From tree;

adityavamsi
Автор

yes sir many times seeing a solution makes it very easy

satyammishra
Автор

Solved this on leetcode. It's a simple select use case or union query.

HorseEngine
Автор

DECODE ( ID, 1, 'ROOT', 2, 'INNER', 'LEAF') Type

kumark
Автор

I follow and watch your all videos sir and learn .agg cte, sub, window query in better way❤

pradeepdhanola
Автор

Very congratulations for blessed with Son's🎉🎉🎉

yasink
Автор

I wish I can just learn how to write complex queries from u. Especially the cte. How to break questions down

chikachika
Автор

Using self join and case for this solution...

PalestineJourney
Автор

Thanks for sharing I really liked the way you solve a query. I have one question that was asked in interview.
there is sequence of numbers in "ID" column of a table and it contains values as (1, 2, 3, 50, 51, 56, 60).
so expected output should be like
gaps_start gaps_end

4 49
52 55
57 59

please share your idea how to solve this.

naiyarazad
Автор

And this is why that is a stupid question to ask at an interview. Because in a real job situation they would have researched it with Google and quickly come up with a solution.

sorvex
Автор

I have one scenario based questions reg SQL table, in this page no option to share the table, so could please help me to reach out to you.

alokkumarsahu
Автор

Hi TFQ, i would like to know how to do a column mapping without using minus or not exist or not in as a part of ETL validation. can you please come up with this?? Thanks

MSDMSD
Автор

Sir actually I just want to know

How can I export my SQL data after shorting please let me know

guitarclasses-
Автор

Brother I want to join your training sessions... please tell me the amount details

kiranratnakara
Автор

hi you good teacher I would like attend the class can you send me the link? if you have boot camp

nigistbinyam
visit shbcf.ru