Advanced SQL Tutorial

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ •

  • @kamlist2808
    @kamlist2808 4 роки тому +8

    What a legen! His restaurants went bankrupt but now he teaches us SQL. Thank you Jamie Oliver

  • @zackjones8681
    @zackjones8681 5 років тому +8

    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.

  • @jonnywright8155
    @jonnywright8155 3 роки тому +1

    I find your vids real helpful as a full stack dev tweaking sprocs every now and then. Thanks for the content.

  • @shreyapansari5114
    @shreyapansari5114 4 роки тому +5

    Amazing ! finally could understand coalesce and pivot. Please make videos on stored procedures, CTE and materialised views.

  • @IanJohnstonblog
    @IanJohnstonblog 3 роки тому +3

    Great Video. Thanks for making your series on SQL... I've learned a ton from your clear and concise explanations.

  • @angelchavez5507
    @angelchavez5507 3 роки тому +1

    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 роки тому +2

      Always like to know I'm helping people. That is what it is all about.

  • @Squeez210
    @Squeez210 2 роки тому +1

    >Thanks for watching
    Thanks for creating

  • @philippebalech1252
    @philippebalech1252 Рік тому

    Man you just rock thank you for sharing ❤

  • @preranadas4037
    @preranadas4037 3 роки тому +1

    Loved the video!!! thank you for making this amazing video.

  • @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! :)

  • @sinvalfelisberto
    @sinvalfelisberto Рік тому

    Thank you! Great video!

  • @sgpleasure
    @sgpleasure 3 роки тому +1

    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.

  • @DARULULOOMKARACHI
    @DARULULOOMKARACHI 4 роки тому +1

    Hi, We may also use Isnull(s.ProductID, e.ProductID) ProductID instead of coalesce this gives also same output. plz verify.

  • @septimusseverus252
    @septimusseverus252 3 роки тому

    Thanks bro... Amazing video

  • @ritchiedecoma6504
    @ritchiedecoma6504 4 роки тому

    Nice breakdown of pivot table

  • @MichalH-z9p
    @MichalH-z9p 10 місяців тому

    at the first query, isn't it the same as union all? instead of left join+coalesce? if not, when do you use which?

  • @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

  • @YouScrub123
    @YouScrub123 2 роки тому

    Great video!

  • @juandavidgomezrestrepo6110
    @juandavidgomezrestrepo6110 4 роки тому

    This is super useful stuff , thanks a lot mate

  • @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.

  • @palanit4191
    @palanit4191 5 років тому +2

    Thanks for the video. Can you please make a video on how Enterprise manager reports can be leveraged.

    • @JamesOliver
      @JamesOliver  5 років тому +2

      Great suggestion! I will put that on my list.

  • @AnshulMarele-gbaa
    @AnshulMarele-gbaa Рік тому

    How to enable viewing syntax and command definition [while typing any command] in MS-SQL as we see in Excel

  • @kshathrugan5238
    @kshathrugan5238 4 роки тому

    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

  • @shadow_gaming_sk
    @shadow_gaming_sk 2 роки тому

    Can you prepare basic to advanced series, so every one can learn SQL

  • @ZnSstr
    @ZnSstr 4 роки тому

    Not sure if you will ever respond but.. why you didn't used the alias for ProductId in the COUNT function?

  • @ryanjennings6233
    @ryanjennings6233 4 роки тому +1

    In the pivot statement, would it have been possible to select distinct values rather than listing them?

    • @JamesOliver
      @JamesOliver  4 роки тому

      You need to reference the actual column names. A select returns the values. Unless I'm misunderstanding the question.

    • @talantsarman9009
      @talantsarman9009 2 роки тому

      @@JamesOliver i guess he meant making a subquery with (select distinct(c.name or category) from productcategory). can we do that in here?

  • @iliashterev38
    @iliashterev38 3 роки тому

    Great videos. Thank you. Only if you can control those juicy tong sounds.

  • @waltherziemerink
    @waltherziemerink 4 роки тому +1

    Excellent tutorial

    • @JamesOliver
      @JamesOliver  4 роки тому

      Neo-1 I appreciate the kind words

  • @kavyatripathi2151
    @kavyatripathi2151 2 роки тому

    loved it :)

  • @aquaticsplashes
    @aquaticsplashes 4 роки тому

    @3:17 is there a is not null for the product id or is that a different concept?

  • @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?

  • @sigma_z
    @sigma_z 3 роки тому

    Brilliant! Well done!

  • @darrylw99
    @darrylw99 4 місяці тому

    It's rubbish that you have to hard code the columns for the pivot... can you not do a select Distinct to populate that?

  • @FirstNameLastName-kt3zn
    @FirstNameLastName-kt3zn 5 років тому

    This was a helpful explanation of PIVOT

  • @Nei月牙天衝-y7u
    @Nei月牙天衝-y7u 2 роки тому +1

    It would be hella cool if you add timestamps

  • @iitian2012
    @iitian2012 4 роки тому +1

    hi your advanced sql session is really helpful...could you please upload some more advanced queries?

    • @JamesOliver
      @JamesOliver  4 роки тому +1

      ADITYA ANAND sure will do

    • @iitian2012
      @iitian2012 4 роки тому

      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 4 роки тому

    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)

  • @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 роки тому +1

      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
      !

  • @hebaza9668
    @hebaza9668 Рік тому

    how can i find to this database?

  • @vincepeterson2834
    @vincepeterson2834 3 роки тому

    Great video.

  • @rishavbahuguna2655
    @rishavbahuguna2655 4 роки тому

    Will I be able to apply this on mysql??

  • @dotnetdevni
    @dotnetdevni 3 роки тому +1

    How un earth is this considered advanced

  • @IanDangerfield
    @IanDangerfield 4 роки тому

    appreciate the vid brother

  • @midnightrun335
    @midnightrun335 4 роки тому

    If I had u as my datasci professor I couldve been working at IBM by now

  • @shijujohn9969
    @shijujohn9969 3 роки тому

    Thank you

  • @reyvenobalan8204
    @reyvenobalan8204 4 роки тому

    what application are you using sir ?

    • @JamesOliver
      @JamesOliver  4 роки тому

      Sql server express and management studio. All free.

  • @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.

  • @seleniumshyamala5223
    @seleniumshyamala5223 4 роки тому

    Nice!!

  • @sawseries2939
    @sawseries2939 3 роки тому

    Thx

  • @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

  • @itreportcambodia8283
    @itreportcambodia8283 4 роки тому

    How are you.

  • @50tigres79
    @50tigres79 3 роки тому

    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