Independent vs Correlated Subquery | Advanced SQL Tutorial For Beginners

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

Ankit Bansal

Ankit Bansal

Күн бұрын

Пікірлер: 35
@ankitbansal6
@ankitbansal6 Жыл бұрын
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/course-detail/think-sql-go-from-zero-to-hero-english
@jayselokar
@jayselokar Жыл бұрын
also correlated is more time consuming
@UnrealAdi
@UnrealAdi Жыл бұрын
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!
@kanikasuneja7777
@kanikasuneja7777 Ай бұрын
The link is directing to error page
@ankitbansal6
@ankitbansal6 Ай бұрын
@@kanikasuneja7777 fixed it. Thank you!
@shubh_pokharkar8145
@shubh_pokharkar8145 2 ай бұрын
This is the best video i have seen on corelated subquery which not only showed how we can solve question with independent subquery , thankyou for such great videos , gratitude🙏🙏
@ankitbansal6
@ankitbansal6 2 ай бұрын
Glad it was helpful!
@shivammishra-mk9jp
@shivammishra-mk9jp 7 ай бұрын
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 Жыл бұрын
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
@prajjwaljaiswal3419
@prajjwaljaiswal3419 Жыл бұрын
Best video in internet till now explaining the difference
@avi8016
@avi8016 Жыл бұрын
Great explanation 💯 Would you like more videos like this where you cover important topics. Thankyou!!😊
@ankitbansal6
@ankitbansal6 Жыл бұрын
Sure 😊
@vandanaK-mh9zo
@vandanaK-mh9zo Жыл бұрын
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
@ayyappansri
@ayyappansri 8 ай бұрын
Ultimate explanation ❤
@ankitbansal6
@ankitbansal6 8 ай бұрын
Thanks a lot 😊
@parth_pm16
@parth_pm16 Жыл бұрын
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
@anjibabumakkena
@anjibabumakkena Жыл бұрын
Hi Ankit, Can You explain Performance tuning.
@ankitbansal6
@ankitbansal6 Жыл бұрын
Sure
@alkalisblaze
@alkalisblaze Жыл бұрын
Hey @ankitbansal6, you missed a paranthesis ')' in your insert statement while inputting for Ankit's entry.
@ankitbansal6
@ankitbansal6 Жыл бұрын
Thanks 🙏
@ritudahiya6223
@ritudahiya6223 Жыл бұрын
@ankit bansal please tell for analytics point of view which platform is better for practicing sql.. Leetcode or data lemur?
@ankitbansal6
@ankitbansal6 Жыл бұрын
NamasteSQL : www.namastesql.com/coding-problems
@Shri-RAM-JaiBajrangBali
@Shri-RAM-JaiBajrangBali Жыл бұрын
Hi Ankit, Please also explain inline queries..
@sandipansarkar9211
@sandipansarkar9211 Жыл бұрын
finished watching
@chiranjeevic8384
@chiranjeevic8384 Жыл бұрын
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 Жыл бұрын
Not so important
@tumusaikarthik6632
@tumusaikarthik6632 Жыл бұрын
Mostly core sql is used 95% the select queries
@vinodpaluvuri54
@vinodpaluvuri54 Жыл бұрын
Hi Ankit, can you let us know when to use correlated subquery.
@ankitbansal6
@ankitbansal6 Жыл бұрын
Check my pinned comment
@navneethks8677
@navneethks8677 9 ай бұрын
Very Helpful 🫂🫂
@shruthi.hshruthi3965
@shruthi.hshruthi3965 Жыл бұрын
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 Жыл бұрын
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 10 ай бұрын
Hey, To know this, please get the understanding of sql order of execution. You'll be able to understood
@akhiladevangamath1277
@akhiladevangamath1277 4 ай бұрын
bcz, select executes after group by, so avg is calculated during the execution of select, group by won't be knowing avg during its execution
@sandipansarkar9211
@sandipansarkar9211 Жыл бұрын
finished watching
Full Outer Join in Depth Tutorial | Advanced SQL Tutorial
29:02
Ankit Bansal
Рет қаралды 9 М.
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Querying 100 Billion Rows using SQL, 7 TB in a single table
9:07
Arpit Agrawal (Elastiq.AI)
Рет қаралды 59 М.
SQL Subquery | Complete Guide with Correlated Subquery | #SQL Course #15
1:21:28
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН