What Are Foriegn Keys? A Video Quiz
0:31
What are Primary Keys - A Video Quiz
0:32
Null: Databases for Developers #10
7:42
Пікірлер
@anitharanganathan8888
@anitharanganathan8888 Күн бұрын
Finally found the best explanation. Thanks much🎉
@arunpunneeth5427
@arunpunneeth5427 13 күн бұрын
What you said Insert script it will not work all wrong
@kebincui
@kebincui 15 күн бұрын
The most vivid explatnion about joins., easy to understand👍👍 thanks
@graht1
@graht1 15 күн бұрын
The right side of the tree was just bugging me :) It can be fixed with REVERSE. WITH tree ( lvl, fill ) AS ( SELECT 1 lvl, LPAD('*', 11, ' ') fill FROM dual UNION ALL SELECT lvl + 1 lvl, LPAD( LPAD( RPAD( '|', lvl + 1, '\' ), ((lvl + 1) * 2) - 1, '/' ), 12 + lvl - 1, ' ' ) fill FROM tree WHERE 1=1 AND lvl < 8 ) SELECT '''' || RPAD( REVERSE( REPLACE( REVERSE( REPLACE( fill, '//', '/*' ) ), '\\', '\*' ) ), 21, ' ' ) || '''' xmastree FROM tree UNION ALL SELECT '''' || rpad( LPAD('|||', 12, ' '), 21, ' ' ) || '''' from dual
@Артем-х7п6с
@Артем-х7п6с Ай бұрын
8:15 I don't understand this case. If we need to join only five cards to other deck then why hash join have got to go through every single card in first deck?? Is it not equivalent to "first table(5 cards except first deck) join second table (second deck)"? Then we just need to make hash table with 5 hashes
@Артем-х7п6с
@Артем-х7п6с Ай бұрын
Oh, I found the answer below
@brucewetzel
@brucewetzel Ай бұрын
Love these quick, yet so informative videos. Please keep them coming. Thank you!
@TheMagicofSQL
@TheMagicofSQL Ай бұрын
You're welcome; glad you appreciate these. I certainly plan to keep publishing these :)
@ilpaolotopleggend6663
@ilpaolotopleggend6663 Ай бұрын
Thanks
@francodominguez304
@francodominguez304 Ай бұрын
Bro, thank you very much for all the knowledge you transmit. Out of curiosity, what is the IDE you use in your videos? Are you using any VSCode extension? Greetings from Argentina!
@TheMagicofSQL
@TheMagicofSQL Ай бұрын
Thanks - you're welcome. I create these using an internal tool here at Oracle
@onehmong9368
@onehmong9368 Ай бұрын
Always nice
@onehmong9368
@onehmong9368 Ай бұрын
Nice
@onehmong9368
@onehmong9368 Ай бұрын
Huh
@mprokop6
@mprokop6 Ай бұрын
no audio?
@TheMagicofSQL
@TheMagicofSQL Ай бұрын
No - is it necessary?
@mprokop6
@mprokop6 Ай бұрын
@@TheMagicofSQL If this was intentional, then nvm
@mprokop6
@mprokop6 Ай бұрын
It's just quite common for videos to have some kind of voiceover
@TheMagicofSQL
@TheMagicofSQL Ай бұрын
Yeah - I'm experimenting to see how this works. I can try talking over these if you're keen to hear my voice ;)
@chungusmcjaxx5799
@chungusmcjaxx5799 2 ай бұрын
Thanks. Explained visually nested loops in 90 seconds. Appreciate your method with cards. Thank you.
@TheMagicofSQL
@TheMagicofSQL Ай бұрын
You're welcome; glad you appreciate it!
@avimcrypto
@avimcrypto 2 ай бұрын
Can i change the query snap UI... Different to see and to understand... Can u make some changes in video... And make graphic easier
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
What changes do you want to see? What would make graphic easier?
@onehmong9368
@onehmong9368 2 ай бұрын
So serious man. I swear they would crucify me if I write sql in lower cases. Thanks
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
If you're using a standard formatter for SQL, it makes sense to use the same case for all statements. If not, there's much more important things to get worked up about!
@onehmong9368
@onehmong9368 2 ай бұрын
@TheMagicofSQL nice
@onehmong9368
@onehmong9368 2 ай бұрын
Aaah I don't feel too bad writing sql in lower case like in c and c++
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
Lowercase is the way!
@nguyennguyenkhoi7111
@nguyennguyenkhoi7111 2 ай бұрын
Thanks bro, It's really nice and clear explaination. However, I still have 1 question. Why do we need to run "Hash Function" in the whole table? Why don't we hash 5 cards and do the JOIN?
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
See my response to ArthurMontgomery-d2p - how do you know which 5 rows to pick from the first table?
@pablolocles9382
@pablolocles9382 2 ай бұрын
But doing that you won't achieve the best performance using indexes and keys. Join handles it much better, even if you don't use the other table outputs.
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
Can you demonstrate a case where that happens? Oracle Database transforms IN/EXISTS into joins under the covers, so the performance of these three should be identical
@FiruzzZ-777
@FiruzzZ-777 2 ай бұрын
flawless explanations!, you deserve your hair back
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
😂 thanks!
@staykings6943
@staykings6943 2 ай бұрын
Thanks for this 💱
@IncredibleAdventure1
@IncredibleAdventure1 2 ай бұрын
Hello Chris, I have one question regarding order by. Does Oracle Database sort results in ascending order based on the first column of the first query when using set operator Union implicitly(by default)?
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
No. If you use UNION ALL the database just combines the data sets. If you use UNION it'll add a deduplication step. This *might* be implemented using a sort. A hash is more likely though.
@francisantony12
@francisantony12 3 ай бұрын
This helped me a lot. Thank you for this video
@TheMagicofSQL
@TheMagicofSQL 2 ай бұрын
You're welcome! Glad this is useful
@ArthurMontgomery-d2p
@ArthurMontgomery-d2p 3 ай бұрын
Great video. Thanks. But I didn't understand the reason why the example of joining only five cards in the outer deck shows the disadvantage of hash join (from 8:17 to 8:25). I mean, why can't we simply apply the hash function to those five values? That only costs five operations to construct the hash memory structure?
@TheMagicofSQL
@TheMagicofSQL 3 ай бұрын
How do you know what the top five values are before doing the join? If you want to (inner) join t1 to t2 and get the first five joined rows there's no general way to pick five from t1 that will join to t2. The values you pick from t1 may have no match in t2. Using a hash, you have to read all the rows from t1. Then join to t2, stopping as soon as you have five rows in the results.
@ArthurMontgomery-d2p
@ArthurMontgomery-d2p 3 ай бұрын
@@TheMagicofSQL Thanks for the clarification! I took the five cards as already known.😅
@nishanksoni7120
@nishanksoni7120 3 ай бұрын
1.Nested Join - nested for loop - O(N * N) - easiest to implement - time consuming for large dataset - better with either small datasets or index on join attributes 2.Merge Join - sort them first and compare - O(NlogN) + O(NlogN) - Efficient for large datasets - pre-join preparation required (sorting) - scanning of relation happens once while joining - can leverage indexes if available to make it faster 3.Hash Join - using hashing - not good for range queries - creating a hashtable for the query you are searching ( user_id is the key) - used for equi joins - efficient for large datasets - requires additional memory - pre join preparation required -> hash table construction - Hash function should distribute data evenly SQL Engine : Take a look at data , look statistics across all table using cardinality
@TheMagicofSQL
@TheMagicofSQL 3 ай бұрын
Nice summary. Though - at least in Oracle Database - hash join is worse than "not good" for range queries. The optimizer won't use it at all!
@sandhu01
@sandhu01 3 ай бұрын
Very well put 👏 @6:20 - 52*log52 equals 296.4 because the base is 2 not 10.
@TheMagicofSQL
@TheMagicofSQL 3 ай бұрын
52 * ln 52 ~ 205 isn't it? :) In any case, the exact numbers don't matter too much here - they will vary depending on the algorithm used. It's more the relative size of operations needed for each join type.
@sandhu01
@sandhu01 3 ай бұрын
@@TheMagicofSQL thanks for the reply! Understood! That's why appreciation was in first place :)
@PradeepKanaparthy
@PradeepKanaparthy 4 ай бұрын
HI please one more favour. need post on tuning complex query having multiple joins with example to see changes before tuning and after tuning. some of the tuning changes or tips and how they affect the query and make quick access or give response
@TheMagicofSQL
@TheMagicofSQL 4 ай бұрын
I recently ran an Ask TOM Office Hours session going through some real world tuning examples - see the recording at kzbin.info/www/bejne/m6itkqCEipt8j5I
@PradeepKanaparthy
@PradeepKanaparthy 4 ай бұрын
@@TheMagicofSQL Thank you 😊
@surajkumarsingh4857
@surajkumarsingh4857 4 ай бұрын
Wow What an Explanation : )
@TheMagicofSQL
@TheMagicofSQL 4 ай бұрын
Thanks :)
@danpd1238
@danpd1238 4 ай бұрын
nice video!
@user-qb7cc3cw7l
@user-qb7cc3cw7l 4 ай бұрын
Please go little so your accent not comfortable for asians😢😢
@andrevinicius137
@andrevinicius137 5 ай бұрын
Pure Gold!
@NuProg
@NuProg 6 ай бұрын
I have to create index for a huge table (In Gigabytes) for a new column. But when we tried this, it is bringing down the system completely so we had to drop that. Is there any way we can create this index without downtime.
@TheMagicofSQL
@TheMagicofSQL 6 ай бұрын
I'm unsure what "bringing down the system completely" means exactly. In Oracle Database you can CREATE INDEX ... ONLINE which allows the database to write to the table while creating the index which may help here.
@NuProg
@NuProg 6 ай бұрын
@@TheMagicofSQL Thank you for the quick reply. 'Bringing down' - I was meaning that the CPU and memory were full due to the size of the table and was taking hours to complete. So is there a way to create index in a performant way on this table?
@TheMagicofSQL
@TheMagicofSQL 6 ай бұрын
While a table in the gigabytes is big, it still shouldn't take hours to create an index on it. Creating an index will only use 1 cpu by default. So either the system only has a couple of cpus (in which case you should look at getting more) or it's running in parallel - reducing the parallelism will help. I would still start by using the ONLINE keyword when creating the index before trying anything else though. It might take a long time, but other operations should continue normally (unless your system does have to few CPUs for the workload)
@NuProg
@NuProg 6 ай бұрын
@@TheMagicofSQL Thanks again. I shall try this and will update here on how it goes.
@emilemary
@emilemary 6 ай бұрын
Excellent presentation, the best SQL course!! I love the creativity in your videos. Thank you so much!!
@TheMagicofSQL
@TheMagicofSQL 6 ай бұрын
You're welcome, glad you appreciate these!
@HarrietOmboga
@HarrietOmboga 6 ай бұрын
I like how its explained though I dont get most of it
@TheMagicofSQL
@TheMagicofSQL 6 ай бұрын
What is it you're struggling to understand?
@SinskariBoi3366three
@SinskariBoi3366three 6 ай бұрын
Refreshing
@hindimotivation5231
@hindimotivation5231 7 ай бұрын
I am not able to understand the autotrace part where view part individual elapsed time is 728 micro seconds. How this was calculated , Please elaborate. Thankyou.
@hindimotivation5231
@hindimotivation5231 6 ай бұрын
One more doubt , in 3rd sort operation why it dont have any elpsed time as you said in video.
@TheMagicofSQL
@TheMagicofSQL 6 ай бұрын
I'm not sure exactly what you're referring to - please clarify. In any case, this value comes from the database measuring how long the operation took.
@TheMagicofSQL
@TheMagicofSQL 6 ай бұрын
Again, I'm not sure exactly what you're referring to.
@IgorSadovskii
@IgorSadovskii 7 ай бұрын
usefull explanation ! thanks a lot!
@robertczaja176
@robertczaja176 7 ай бұрын
Well explained!
@robertczaja176
@robertczaja176 7 ай бұрын
Perfect video! You can explain things that everyone can understand it!
@dothanhlong1847
@dothanhlong1847 7 ай бұрын
.
@AndrewCoffman-jq9ld
@AndrewCoffman-jq9ld 7 ай бұрын
Been doing MSSQL for 20 years and this was by far the best explanation of these joins. Thanks!
@TheMagicofSQL
@TheMagicofSQL 7 ай бұрын
You're welcome!
@vialvial1246
@vialvial1246 7 ай бұрын
Best explanation! Thank you sir!