Independent vs Correlated Subquery | Advanced SQL Tutorial For Beginners

  Рет қаралды 12,892

Ankit Bansal

Ankit Bansal

Күн бұрын

Пікірлер: 31
@ankitbansal6
@ankitbansal6 7 ай бұрын
99 percent of the time you can solve a problem using an independent query with a combination of cte and window functions. As the correlated sub queries are not so performance always try to avoid them. If you are looking to learn SQL from basic to advanced with lots of practice material and projects do consider my 0 to hero SQL course : www.namastesql.com/courses/SQL-For-Analytics-6301f405e4b0238f71788354
@jayselokar
@jayselokar 7 ай бұрын
also correlated is more time consuming
@UnrealAdi
@UnrealAdi 7 ай бұрын
Hi @ankitbansal6, the script provided don't match with the result set of the emp table! Fixing it may be useful. Also, thanks for the incredible content as usual!
@shivammishra-mk9jp
@shivammishra-mk9jp 14 күн бұрын
I saw multiple videos on this topic, but trust me guy's no one can simplify the lang. or concept other than Mr. Ankit Bansal. Respect you sir for a reason 🙏🙏 thanks a lot❤
@DEEPAK-jx5si
@DEEPAK-jx5si 7 ай бұрын
Here is my Solution select * from (select *, avg(salary) over(partition by department_id ) as avg_dep_sal from emp) e where e.avg_dep_sal < e.salary
@vandanaK-mh9zo
@vandanaK-mh9zo 7 ай бұрын
why we need subqueries: when the required format of the data is not given/not available, then we need to derive it and the join it back with the main data. Independent Subquery - 1. it can be run independently 2. it runs only once Correlated Subquery - 1. It cannot run independently because it has the reference of the main query 2. it runs for every record of the main query
@prajjwaljaiswal3419
@prajjwaljaiswal3419 7 ай бұрын
Best video in internet till now explaining the difference
@gazart8557
@gazart8557 7 ай бұрын
Excellent
@avi8016
@avi8016 7 ай бұрын
Great explanation 💯 Would you like more videos like this where you cover important topics. Thankyou!!😊
@ankitbansal6
@ankitbansal6 7 ай бұрын
Sure 😊
@parth_pm16
@parth_pm16 7 ай бұрын
Solution using "AVG(salary) over ()" Solution: select * from (select * ,avg(salary) over(partition by department_id) avg_dep_salary from emp_6_dec) s where salary>avg_dep_salary
@ayyappansri
@ayyappansri Ай бұрын
Ultimate explanation ❤
@ankitbansal6
@ankitbansal6 Ай бұрын
Thanks a lot 😊
@sandipansarkar9211
@sandipansarkar9211 7 ай бұрын
finished watching
@Shri-RAM-JaiBajrangBali
@Shri-RAM-JaiBajrangBali 7 ай бұрын
Hi Ankit, Please also explain inline queries..
@navneethks8677
@navneethks8677 3 ай бұрын
Very Helpful 🫂🫂
@alkalisblaze
@alkalisblaze 7 ай бұрын
Hey @ankitbansal6, you missed a paranthesis ')' in your insert statement while inputting for Ankit's entry.
@ankitbansal6
@ankitbansal6 7 ай бұрын
Thanks 🙏
@ritudahiya6223
@ritudahiya6223 7 ай бұрын
@ankit bansal please tell for analytics point of view which platform is better for practicing sql.. Leetcode or data lemur?
@ankitbansal6
@ankitbansal6 7 ай бұрын
DataLemur
@anjibabumakkena
@anjibabumakkena 7 ай бұрын
Hi Ankit, Can You explain Performance tuning.
@ankitbansal6
@ankitbansal6 7 ай бұрын
Sure
@chiranjeevic8384
@chiranjeevic8384 7 ай бұрын
Hi Ankit, is the PLSQL concepts like stored procedures, triggers important for a data engineer ? If it's important, can you pls make a vedio on it ?
@ankitbansal6
@ankitbansal6 7 ай бұрын
Not so important
@tumusaikarthik6632
@tumusaikarthik6632 7 ай бұрын
Mostly core sql is used 95% the select queries
@vinodpaluvuri54
@vinodpaluvuri54 7 ай бұрын
Hi Ankit, can you let us know when to use correlated subquery.
@ankitbansal6
@ankitbansal6 7 ай бұрын
Check my pinned comment
@shruthi.hshruthi3965
@shruthi.hshruthi3965 7 ай бұрын
Hi @ankitbansal6 i m new to sql can anyone explain why cant we use select department_id ,avg(salary) as avgsal from emp groupby department_id having salary> avg(salary)
@hamzarahman7763
@hamzarahman7763 7 ай бұрын
if you want to solve this way you should Learn Self Join first... Hint: you have to separate avg(salary) into different intermediate table, because code don't know whats is avg(salary)..
@suriyas6338
@suriyas6338 3 ай бұрын
Hey, To know this, please get the understanding of sql order of execution. You'll be able to understood
@sandipansarkar9211
@sandipansarkar9211 7 ай бұрын
finished watching
Full Outer Join in Depth Tutorial | Advanced SQL Tutorial
29:02
Ankit Bansal
Рет қаралды 7 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 1,6 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 120 МЛН
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
Рет қаралды 11 МЛН
SQL | NOT IN Vs NOT EXISTS (Which one to use?)
10:03
Learn at Knowstar
Рет қаралды 10 М.
Next level FILTER Function tricks | Excel Off The Grid
13:23
Excel Off The Grid
Рет қаралды 14 М.
ПРОВЕРИЛ АРБУЗЫ #shorts
00:34
Паша Осадчий
Рет қаралды 1,6 МЛН