Тёмный

Advanced SQL Tutorial 

James Oliver
Подписаться 12 тыс.
Просмотров 102 тыс.
50% 1

In this tutorial I will cover many advanced SQL concepts like full outer joins, coalesce, cross apply, outer apply, intersect, except and pivot.
NOTE: The database I use for this tutorial is MS SQL Server and the syntax can vary depending on the database.

Опубликовано:

 

20 окт 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 69   
@kamlist2808
@kamlist2808 3 года назад
What a legen! His restaurants went bankrupt but now he teaches us SQL. Thank you Jamie Oliver
@JamesOliver
@JamesOliver 3 года назад
LOL ;)
@jonnywright8155
@jonnywright8155 3 года назад
I find your vids real helpful as a full stack dev tweaking sprocs every now and then. Thanks for the content.
@IanJohnstonblog
@IanJohnstonblog 3 года назад
Great Video. Thanks for making your series on SQL... I've learned a ton from your clear and concise explanations.
@zackjones8681
@zackjones8681 4 года назад
Thanks for this. I finally have PIVOT working! I've converted two stored procedures so far and will be converting more now that I understand how it works.
@angelchavez5507
@angelchavez5507 3 года назад
Thank you! I was looking for the SQL equivalent of the || operator, and had read about coalesce before. Your video really made it "click" for me.
@JamesOliver
@JamesOliver 3 года назад
Always like to know I'm helping people. That is what it is all about.
@shreyapansari5114
@shreyapansari5114 4 года назад
Amazing ! finally could understand coalesce and pivot. Please make videos on stored procedures, CTE and materialised views.
@andpiojo
@andpiojo 2 года назад
Great vid! Difficult topics explained in a very clear and easy way to understand! Thanks and keep them coming!
@JamesOliver
@JamesOliver 2 года назад
Thank you so much! Will do! :)
@preranadas4037
@preranadas4037 3 года назад
Loved the video!!! thank you for making this amazing video.
@juandavidgomezrestrepo6110
@juandavidgomezrestrepo6110 3 года назад
This is super useful stuff , thanks a lot mate
@sinvalfelisberto
@sinvalfelisberto Год назад
Thank you! Great video!
@sigma_z
@sigma_z 3 года назад
Brilliant! Well done!
@philippebalech1252
@philippebalech1252 Год назад
Man you just rock thank you for sharing ❤
@kavyatripathi2151
@kavyatripathi2151 Год назад
loved it :)
@YouScrub123
@YouScrub123 2 года назад
Great video!
@Squeez210
@Squeez210 2 года назад
>Thanks for watching Thanks for creating
@IanDangerfield
@IanDangerfield 3 года назад
appreciate the vid brother
@FirstNameLastName-kt3zn
@FirstNameLastName-kt3zn 4 года назад
This was a helpful explanation of PIVOT
@JamesOliver
@JamesOliver 4 года назад
Glad you liked. :)
@ritchiedecoma6504
@ritchiedecoma6504 3 года назад
Nice breakdown of pivot table
@septimusseverus252
@septimusseverus252 3 года назад
Thanks bro... Amazing video
@waltherziemerink
@waltherziemerink 4 года назад
Excellent tutorial
@JamesOliver
@JamesOliver 4 года назад
Neo-1 I appreciate the kind words
@vincepeterson2834
@vincepeterson2834 3 года назад
Great video.
@JamesOliver
@JamesOliver 3 года назад
Appreciate it very much. :)
@seleniumshyamala5223
@seleniumshyamala5223 4 года назад
Nice!!
@shijujohn9969
@shijujohn9969 3 года назад
Thank you
@palanit4191
@palanit4191 4 года назад
Thanks for the video. Can you please make a video on how Enterprise manager reports can be leveraged.
@JamesOliver
@JamesOliver 4 года назад
Great suggestion! I will put that on my list.
@midnightrun335
@midnightrun335 3 года назад
If I had u as my datasci professor I couldve been working at IBM by now
@JamesOliver
@JamesOliver 3 года назад
Midnight Run :)
@Stelios.Posantzis
@Stelios.Posantzis 4 года назад
Neat and concise. Great for familiarizing oneself with these features. If it included the UNPIVOT statement it would a make for a nice, complete tutorial.
@iliashterev38
@iliashterev38 3 года назад
Great videos. Thank you. Only if you can control those juicy tong sounds.
@aquaticsplashes
@aquaticsplashes 4 года назад
so at @2:10 you want to only select specific columns that they asked for which was the ecom quantity and store quantity don't need to see the color and all that
@DARULULOOMKARACHI
@DARULULOOMKARACHI 3 года назад
Hi, We may also use Isnull(s.ProductID, e.ProductID) ProductID instead of coalesce this gives also same output. plz verify.
@aquaticsplashes
@aquaticsplashes 4 года назад
@3:17 is there a is not null for the product id or is that a different concept?
@sgpleasure
@sgpleasure 3 года назад
So what's the value in using OuterApply or CrossApply? Based on the demo, the result could be achieved with Table Joins. Anyway, I can Google for the answer. Was always curious when to use Cross Apply or Outer Apply, never knew the answer until this came up in a job interview.
@sawseries2939
@sawseries2939 3 года назад
Thx
@kshathrugan5238
@kshathrugan5238 3 года назад
Cool, i have a doubt. Suppose i have a table with 3 columns say name,id,address and say 100 records. The table has some of the values in name,address filled with null or blank space. I Need to take report which shows me the count of records with blank spaces,null and this shud be achieved without using group by
@sgpleasure
@sgpleasure 3 года назад
SQL is supposed to be simple human readable. Always had issues with the Pivot, the fact that the Categories values had to be hard-coded in the code makes it static. There are solutions on the internet how to first read the list of categories values in a variable.
@user-fx3cs7ew1o
@user-fx3cs7ew1o 5 месяцев назад
at the first query, isn't it the same as union all? instead of left join+coalesce? if not, when do you use which?
@iitian2012
@iitian2012 3 года назад
hi your advanced sql session is really helpful...could you please upload some more advanced queries?
@JamesOliver
@JamesOliver 3 года назад
ADITYA ANAND sure will do
@iitian2012
@iitian2012 3 года назад
Thanks a lot....I am working on data analysis and i have to use sql with advance functions for transformations etc and so I thought that u could help me....thanks ...
@pratikpatra67
@pratikpatra67 3 года назад
Why can't we just go for a simple subquery for the 1st requirement , Select * from table1 t1 where t1.id in (select id from table2)
@ryanjennings6233
@ryanjennings6233 3 года назад
In the pivot statement, would it have been possible to select distinct values rather than listing them?
@JamesOliver
@JamesOliver 3 года назад
You need to reference the actual column names. A select returns the values. Unless I'm misunderstanding the question.
@talantsarman9009
@talantsarman9009 Год назад
@@JamesOliver i guess he meant making a subquery with (select distinct(c.name or category) from productcategory). can we do that in here?
@AnshulMarele-gbaa
@AnshulMarele-gbaa Год назад
How to enable viewing syntax and command definition [while typing any command] in MS-SQL as we see in Excel
@ZnSstr
@ZnSstr 4 года назад
Not sure if you will ever respond but.. why you didn't used the alias for ProductId in the COUNT function?
@nishantm1924
@nishantm1924 3 года назад
how can you import csv file to an already existing table using sql query? like suppose you have Customer table and now you want to add data from xyz.csv file and both Customer and csv file have same attribute ,then how to do such task?
@rishavbahuguna2655
@rishavbahuguna2655 4 года назад
Will I be able to apply this on mysql??
@pwrtricks
@pwrtricks 4 года назад
Hello Mr. Oliver! Could you take a doubt please? Regarding the part of the query before the pivot? I'm using the same base as you and your query, I achieved exactly the same results that you showed in the video. select c.name Category, count (p.productid) totalproducts from production.product p inner join production.productcategory c on c.productcategoryid = p.productsubcategoryid group by c.name go Accessories 8 Bikes 32 Clothing 22 Components 43 It's a simple query like you said then I tried to take the test and I couldn't reach the number that the query arrived I'll take as an example the accessories category (productcategoryid = 4) that gave a total of 8: select * from Production.ProductSubcategory where ProductCategoryID = 4 go productsubcategoryid productcategoryid 26 4 27 4 28 4 29 4 30 4 31 4 32 4 33 4 34 4 35 4 36 4 37 4 Ok, after this result I did this search: select count(productid) count_products_cat_accessories from Production.Product where ProductSubcategoryID between 26 and 37 count_products_cat_accessories 29 If possible, can you show me why I didn't get the result of 8? Thank you!!
@JamesOliver
@JamesOliver 4 года назад
I would have to go back and check but I use this database for other demos/purposes and it is possible I have modified the underlying tables. It has been a little while so would have to check to be sure but that is my guess. Thanks for watching.
@pwrtricks
@pwrtricks 4 года назад
@@JamesOliver I thank you! Your videos helped me a lot, they are very didactic! Ok, I understood what you said about the db but in this case, your query returned exactly the same results as the categories shown in your video. I believe that the bases are hitting. In the future, if you go back to the original DB AdventureWorks2012, I would appreciate it if you can check where I went wrong. Follow the test print link. drive.google.com/file/d/1In0tEldKrakm8YM01qRo_5n5T1or1jXR/view?usp=sharing My best regards !
@shadow_gaming_sk
@shadow_gaming_sk 2 года назад
Can you prepare basic to advanced series, so every one can learn SQL
@user-ti7zu7wz5e
@user-ti7zu7wz5e Год назад
It would be hella cool if you add timestamps
@aquaticsplashes
@aquaticsplashes 4 года назад
@2:45 I guess they don't like to see nulls in their data?
@JamesOliver
@JamesOliver 4 года назад
Yea just quickly handling the NULLs and converting to zero
@hebaza9668
@hebaza9668 Год назад
how can i find to this database?
@reyvenobalan8204
@reyvenobalan8204 3 года назад
what application are you using sir ?
@JamesOliver
@JamesOliver 3 года назад
Sql server express and management studio. All free.
@50tigres79
@50tigres79 2 года назад
should be titled TSQL
@aquaticsplashes
@aquaticsplashes 4 года назад
lost me @4:30 what is this "function"
@JamesOliver
@JamesOliver 4 года назад
Ayejax just a function that returns rows
@itreportcambodia8283
@itreportcambodia8283 3 года назад
How are you.
@dotnetdevni
@dotnetdevni 2 года назад
How un earth is this considered advanced
Далее
Master SQL like a Pro in 20 Minutes
21:12
Просмотров 26 тыс.
Expert Level SQL Tutorial
23:27
Просмотров 152 тыс.
Try not to Laugh Game!
00:38
Просмотров 4,6 млн
It works! #beatbox #tiktok
00:15
Просмотров 2,9 млн
6 SQL Joins you MUST know! (Animated + Practice)
9:47
Просмотров 117 тыс.
SQL Performance Tips
8:47
Просмотров 7 тыс.
SQL - Merge
10:35
Просмотров 34 тыс.
IQ15:  6 SQL Query Interview Questions
20:14
Просмотров 2,2 млн
Advanced T-SQL Takeover!
2:48:35
Просмотров 96 тыс.
Advanced SQL Statements
1:14:23
Просмотров 93 тыс.