Correlated Subqueries vs Derived Tables

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

Bert Wagner

Bert Wagner

Күн бұрын

Пікірлер: 12
@h2oautospa998
@h2oautospa998 5 жыл бұрын
Thank you for such a well done video. I subscribed because I just finished my first mySQL Database Management class. I have to re-do the class and I think your videos will be a big help.
@coding3438
@coding3438 2 жыл бұрын
Hey Bert thanks for the amazing tip. I would really appreciate if you can answer this, is there any problem that absolutely requires correlated sub queries that cannot be solved by joins or derived tables.? I don’t like using them because they confuse me. Thanks.
@ru2979
@ru2979 2 жыл бұрын
True , They are nasty 🥺
@robertkorth605
@robertkorth605 3 жыл бұрын
I have knowed already it but brilliant presented. Thx
@stefanotorelli3688
@stefanotorelli3688 5 жыл бұрын
Depending on the original query window function could the trick too... but .. as always... it depends...
@ulysses1904
@ulysses1904 5 жыл бұрын
Good stuff as always. BTW I have never seen the syntax like (FirstBadgeDate = ) in a select statement. Can you take a moment to explain that, or give it a name so I can research it? I have seen something like that where it was referred to as a quota query but it was in the WHERE clause, like WHERE 2 = (select COUNT(*) from employee EE where E.employeeID = EE.employeeID). I think it was Tony Andrews doing a talk on optimizing DB2 queries where he called it a quota query.
@ulysses1904
@ulysses1904 5 жыл бұрын
@@DataWithBert Thanks Bert. Looks like I was overthinking it and I didn't recognize it as a column alias.
@zanonilabuschagne7628
@zanonilabuschagne7628 5 жыл бұрын
Thanks Bert. I tried your and got different results. I do want to throw another query out, and get your take on it... In the past, I have achieved great performance gains with CROSS APPLY statements with a TOP in it, but when I tested it in this scenario, the results were atrocious. CPU time and reads went through the roof... The query is select DISTINCT o.UserID ,S.FirstBadgeDate from Badges o CROSS APPLY ( select top 1 [Date] as FirstQuoteDate from Badges b WHERE b.UserID = i.UserID Order by b.Date desc ) S Any idea why it went so wrong?
@MiningForPies
@MiningForPies 4 жыл бұрын
You’re also selecting the last date, not the first 🤔
@brendafosmire6519
@brendafosmire6519 5 жыл бұрын
Super helpful videos.
@josephanglada4785
@josephanglada4785 4 жыл бұрын
The Final Solution
@KirillBezzubkine
@KirillBezzubkine 5 жыл бұрын
nice vid. useful. thx
IN vs Union All in SQL Server
6:13
Bert Wagner
Рет қаралды 7 М.
SQL Server Execution Plan Operators
11:15
Bert Wagner
Рет қаралды 25 М.
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
SQL Server Queries Part 12 - Correlated Subqueries
8:21
WiseOwlTutorials
Рет қаралды 95 М.
Does SQL table join order matter?
14:10
Bert Wagner
Рет қаралды 16 М.
Working with SQL Derived Tables | Essential SQL
7:41
Essential SQL (EssentialSQL)
Рет қаралды 2,3 М.
Rewriting Queries with Temporary Staging Tables
6:49
Bert Wagner
Рет қаралды 8 М.
Understanding Correlated Queries in SQL
8:13
Edredo for Learners
Рет қаралды 143 М.
SQL Server Tables vs. Views: What is the Difference?
5:28
Dashboard Gear
Рет қаралды 4,9 М.
Correlated Sub Queries Quickly
4:09
Joes2Pros SQL Trainings
Рет қаралды 23 М.
Гига богатый геймер vs бедный геймер
30:55
Трум Трум Оки Токи
Рет қаралды 114 М.
BIP HOUSE  .бип хаус 🥰🏡  #shorts
0:13
bip_house
Рет қаралды 1,2 МЛН
НЕ ДАМ ЕЁ В ОБИДУ😡 #shorts
0:24
Паша Осадчий
Рет қаралды 1,6 МЛН
(✋❌)kageihina VS siajiwoo VS meosimmyyt VS oxzung#tiktok #shorts
0:12
КОРОЧЕ ГОВОРЯ, НЕДЕЛЯ БЕЗ ТЕЛЕФОНА
3:54
НИКОГДА не иди на сделку с сестрой!
0:11
Даша Боровик
Рет қаралды 729 М.