SQL Ranking Window Functions | ROW_NUMBER, RANK, DENSE_RANK, NTILE, CUME_DIST, PERCENT_RANK

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 103

  • @DataWithBaraa
    @DataWithBaraa  7 месяцев назад +2

    If you want to see more videos like this, Subscribe for more data tutorials like this :) bit.ly/3GiCVUE
    ⏱ TIMESTAMPS ⏱
    ---------------------------------
    00:00 Intro
    00:00:28 What are Window Ranking Functions?
    00:05:48 ROW_NUMBER
    00:10:13 RANK
    00:14:18 DENSE_RANK
    00:18:42 ROW_NUMBER vs RANK vs DENSE_RANK
    00:19:45 ROW_NUMBER: TOP-N Analysis
    00:23:24 ROW_NUMBER: Bottom-N Analysis
    00:27:00 ROW_NUMBER: Assign Unique IDs
    00:29:47 ROW_NUMBER: Identify Duplicates
    00:35:21 NTILE
    00:41:41 NTILE: Data Segmentation
    00:45:35 NTILE: Equalizing Loads
    00:49:02 Intro Percentage Based Ranking
    00:50:10 CUME_DIST
    00:53:52 PERCENT_RANK
    01:01:40 Summary
    Enjoy ☕

  • @trisa_halder
    @trisa_halder Месяц назад +6

    Hi Baraa, I've been struggling to master SQL despite spending hours trying to grasp even the simplest concepts. But then I found your videos, and you've been an incredible teacher. In just two days of watching your content, I’ve started to genuinely enjoy learning SQL. Thanks to you, I now understand complex window functions so much better.
    Thank you for everything you’re doing to help people like me. Wishing you all the best!

  • @fatmaabduarrahman7590
    @fatmaabduarrahman7590 5 месяцев назад +11

    I wonder why something like this doesn't have at least hundreds of thousands of views. Thanks for you efforts

    • @DataWithBaraa
      @DataWithBaraa  5 месяцев назад +1

      With your people like you supporting, maybe my content will reach the others ❤️

  • @sapbo2284
    @sapbo2284 7 месяцев назад +16

    Hi Baraa, Hope you are doing well! Baraa you might don't know how much you are helping people like me.Thanks a million

  • @deepam.g4558
    @deepam.g4558 Месяц назад +1

    I think I am addicted to your videos. Cant stop learning them. Thank you million.

  • @mohammadthousif7439
    @mohammadthousif7439 5 месяцев назад +5

    Greatest tutorial on ranking functions across entire internet ever.

  • @rawanhisham1998
    @rawanhisham1998 18 дней назад +1

    The best channel for studying SQL & Tableau ,such a high quality videos and it's easy to understand your teaching .You made learning SQL more interesting thank you!!!

  • @karasinek997
    @karasinek997 2 месяца назад +3

    bro literally added a smoke effect on the surface of his coffee..
    thanks for the best tutorials on youtube man

  • @dhawalprajapati3705
    @dhawalprajapati3705 6 часов назад +1

    Most underrated SQL advance topic playlist

  • @davidcere16ceresuela28
    @davidcere16ceresuela28 7 месяцев назад +7

    Hi Baraa, you don't realize how amazing your work is! Please, keep it up with the tutorials!! Thanks :)

    • @DataWithBaraa
      @DataWithBaraa  7 месяцев назад +2

      And you don't realize how awesome you are, when you take time a writing me this nice comment 🙂

  • @maoquanjiao2857
    @maoquanjiao2857 12 дней назад +1

    Your video is the best learning material for SQL and Tableau. I am also Bought your courses in Udemy. The Highest quality, the lowest price!!! Thank you!!!

  • @sajibislam3281
    @sajibislam3281 Месяц назад +1

    Thank you so much... You are the best...
    After so much complexity of Learning SQL, You made it easy to learn..
    May Allah bless you..
    Fee amanillah

  • @udaymehta8917
    @udaymehta8917 20 дней назад +1

    Amazing content Baraa sir.
    Covered Rank Window function fully.
    I'm fully confident in Rank function now.
    Initially it looks overwhelming to me, but now it looks very easy to me after following your video and practicing along with you.
    Thank you very much sir.
    Kindly keep enlightening us with your immense knowledge.
    😍😍😍

  • @mrsobhanku
    @mrsobhanku 2 месяца назад +1

    I'm new to this channel and started checking the SQL. After going through many content on RUclips this was the best for me to make all the difficulties in understanding disappear. Thank you. Please continue doing the Great Work. Please create some content on PowerBI as well as this visualization tool is most common for many companies.

  • @UmarDarogha
    @UmarDarogha 2 месяца назад +2

    This channel is criminally underated

  • @Sarang-g9w
    @Sarang-g9w 3 месяца назад +1

    @baraa.. excellent teaching.. i love it.. even paid person can't teach this way... i have learned a lot...appreciate your support brother..

  • @sidramehnaaz
    @sidramehnaaz 2 месяца назад +1

    Hi Baraa, I don’t usually subscribe, but you’ve convinced me-guess I’m officially part of the fan club now!

  • @MonicDevarasetty
    @MonicDevarasetty 2 месяца назад +1

    Great content, Baraa! I totally wasn't expecting such a detailed explanation with all these amazing visuals throughout. Thank you for the content you provide and the effort you put in. You're an amazing teacher! P.S. I love the way you say 'analysis'.

  • @Bhargavi-vz1zt
    @Bhargavi-vz1zt 6 месяцев назад +3

    Thank you Baraa! very Informative and I was able to crack my SQL interview because of your SQL videos..

  • @alexshat4715
    @alexshat4715 Месяц назад +1

    Thank you dear Baraa for the great explanation and useful content!

  • @sugarfree1122
    @sugarfree1122 2 месяца назад +1

    I like the comparison and explanation to make it easier to understand. Thanks!

  • @HadeerMansha
    @HadeerMansha Месяц назад +1

    Thank you so much sir g

  • @santoshkiran5858
    @santoshkiran5858 7 месяцев назад +1

    I'm starting to get the hang of SQL from you're tutorial lecture Simply Brilliant ❤❤❤

  • @narragopichand9982
    @narragopichand9982 5 месяцев назад +1

    I didn’t seen any videos on sql with immense detailed explanations.

  • @Jp-yx8od
    @Jp-yx8od 3 месяца назад +1

    Hey Baraa, I Wish I'd discovered your channel sooner. Awesome way of explaining concepts. Thanks!!

  • @YuttaSihingGusti
    @YuttaSihingGusti 3 месяца назад

    Bara, thank you for your dedication to providing free knowledge. I am fortunate to be able to know you virtually

  • @micaelzekarias1537
    @micaelzekarias1537 7 месяцев назад

    As always I have no word to thank you. God bless u wherever u r.

  • @AnilKumar-dt7ns
    @AnilKumar-dt7ns 2 месяца назад +1

    Hi Barar,
    continuously watching your videos and learning ,good explanation,
    the way your explaining and showing slides, style of explanation is very good

  • @talkwithjyoti1883
    @talkwithjyoti1883 6 месяцев назад +1

    your teaching style is mind blowing

  • @amgadosman3929
    @amgadosman3929 2 месяца назад +1

    Hi Baraa,
    Thank you for the content you provide and the effort you put in.
    You doing great work with amazing visuals, I loved your explaination way that you start with the concept behind the function then give an example in order to illustrate it, and lastly apply it in a use case. "100% analytical mindset" 👏
    Please,Keep It Up with tutorials 🙏

  • @balajithandavan6842
    @balajithandavan6842 8 часов назад +1

    Master Class

  • @ccnebechukwu
    @ccnebechukwu 4 месяца назад

    Best teacher ever...🎉

  • @ahmedabbas4803
    @ahmedabbas4803 21 день назад +1

    wow amazing baraa keep doing you r really amazing

  • @mrmew4547
    @mrmew4547 4 месяца назад +1

    hey sir i have seen so many video but the way you explain is very good and your way of presenting the each topic is very good thanks

    • @DataWithBaraa
      @DataWithBaraa  4 месяца назад

      @@mrmew4547 thanks I really appreciate it

  • @wanggang2396
    @wanggang2396 4 месяца назад +1

    This is definitely the clearest explanation of any tutorial I've ever seen, and I fell in love with this way of thinking analytically, thank you so much for the tutorial.
    By the way, what software do you use to do these visual explanations, and I also want to learn this way to understand complex problems in depth.

    • @DataWithBaraa
      @DataWithBaraa  4 месяца назад

      Hi thanks for the kind words, glad you liked it. I am using drawio and procreate

  • @DivyYadav-hg2js
    @DivyYadav-hg2js 2 месяца назад +2

    BARA UR THE BESSSSTTTTTTTTTTT GONNA SHARE UR CHANNEL,
    MY HUMBLE REQUEST IS PLEASE BRING PROJECTS FOR DATA SCIENCE RELATED TO SQL AND PYTHON PLEASE UR AMAZING NO ONE IS BETTER THAN U

  • @letsdomistakes
    @letsdomistakes 4 месяца назад +1

    Thank you Baraa I have completed this tutorial today.

  • @azaansfunworld4300
    @azaansfunworld4300 7 месяцев назад

    I am excited even before going through the video ….i am sure I m going to enjoy this … Thanqqqqqq

  • @andrescorrea9640
    @andrescorrea9640 7 месяцев назад +1

    Outstanding! 👏🏻👏🏻👏🏻
    Thank you so much!

  • @singhSAURABH29
    @singhSAURABH29 3 месяца назад +1

    Thanks for providing such amazing information❤

  • @venkateshperumal4222
    @venkateshperumal4222 7 месяцев назад +1

    Thank you so much, was waiting for this video eagerly!!!

    • @DataWithBaraa
      @DataWithBaraa  7 месяцев назад

      You are welcome, i hope you will enjoy it !

  • @sowmya6471
    @sowmya6471 6 месяцев назад +1

    Thanks for introducing advance concept Cume_dist(). It is gonna help me in my office work.

  • @anchalgajbhiye7085
    @anchalgajbhiye7085 2 месяца назад +1

    That constant smoke from coffee mug

  • @mdanisurrahman357
    @mdanisurrahman357 7 месяцев назад +1

    Awesome,, pls keep making more extraordinary videos

  • @Toyahan43
    @Toyahan43 3 месяца назад +1

    Best lecture from the best teacher I can't thank you enough for all the good you are doing. God bless you brother

  • @sagargaryali1345
    @sagargaryali1345 4 месяца назад +1

    Hi Baraa,
    You have made learning so easy and fun. Thank you so much for all the guidance.
    Can you please make videos on query optimization, tuning, indexation as well please.

  • @My_query
    @My_query 6 месяцев назад +1

    Keep doing it bro your explanation makes more sense I bet you.

  • @devinanissa7928
    @devinanissa7928 6 месяцев назад +1

    I really feel blessed that you made this all video. It's really interesting and easy to understand. when the 1st time i watched your video, i am immediately subscribe!! Great Job Baraa!! Thank you

    • @DataWithBaraa
      @DataWithBaraa  6 месяцев назад +1

      I am aswell blessed to be able to reach kind people like you, thanks for the support and glad you liked it

  • @zaidandhman7687
    @zaidandhman7687 3 месяца назад +1

    Hello Braa, thank you for your tutorials-they’re clear and amazing! Keep up the great work. I wanted to ask about the software you use to create the explanatory drawings.

  • @jaideepthanage4934
    @jaideepthanage4934 7 месяцев назад

    Was waiting for this eagerly!❤

  • @CuocSongQuanhTa204
    @CuocSongQuanhTa204 7 месяцев назад +1

    Thanks Baraa as always!

  • @ransfordsaddicamoleka2924
    @ransfordsaddicamoleka2924 5 месяцев назад +1

    Thanks very much Baraa

  • @SaadiaZahoor-i6b
    @SaadiaZahoor-i6b 4 месяца назад +1

    Thanx brother for cmprehensive video

  • @asrithagudla4865
    @asrithagudla4865 3 месяца назад +1

    thanks alot😁

  • @alokranjan7323
    @alokranjan7323 3 месяца назад +1

    Thank you

  • @ahmedosama-p3m
    @ahmedosama-p3m 4 месяца назад +1

    amazing

  • @SheikhMohammadHussain-e7i
    @SheikhMohammadHussain-e7i 4 месяца назад +1

    Hi Baraa, I wanted to ask something, if I use three RANK function in a query but partition those by three different expressions, the result is a bit confusing? What is the order of execution and how does it work? Example:
    SELECT
    OrderID,
    OrderDate,
    ProductID,
    Sales,
    RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) AS RankSales,
    RANK() OVER(PARTITION BY OrderID ORDER BY SALES DESC) AS RankSales,
    DENSE_RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) AS DenseRankSales
    FROM Sales.Orders
    And Thanks for being the best teacher ever

    • @DataWithBaraa
      @DataWithBaraa  4 месяца назад +1

      Thanks for kind words and great question !!
      Here's an explanation:
      The key here is to understand that each RANK function operates independently! Based on your query the data will be partitioned three times and sorted three times.
      For example:
      RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) ranks sales within each product.
      RANK() OVER(PARTITION BY OrderID ORDER BY SALES DESC) ranks sales within each order.
      DENSE_RANK() OVER(PARTITION BY ProductID ORDER BY SALES DESC) gives a dense rank within each product.
      So each one of them will be executed independently. I hope this helps.

    • @SheikhMohammadHussain-e7i
      @SheikhMohammadHussain-e7i 4 месяца назад +1

      @@DataWithBaraa Thanks a lot ! Now it's clear.

  • @daayush6654
    @daayush6654 4 месяца назад +1

    Amazing explanations with the visualization 🐐.
    Btw is that Nescafe your super hot coffee ☕ or air purifier🍀

  • @sarphoah
    @sarphoah 6 месяцев назад +1

    Thank you so much Baraa! Your videos are so helpful. I appreciate the effort you put into them. Can you please do a video on handling different Date types in SQL?

    • @DataWithBaraa
      @DataWithBaraa  6 месяцев назад

      Thank for the kind words, yes I’ll cover it in my course!

  • @rakibulhaque3444
    @rakibulhaque3444 3 месяца назад

    Thanks

  • @soumyamondal297
    @soumyamondal297 3 месяца назад +1

    Thank you sir for your sharing knowledge ❤.
    Sir can you share the dataset for every table and table creation script. It is helpful for practice everything. Thank you sir

    • @DataWithBaraa
      @DataWithBaraa  3 месяца назад

      Hi Thanks ! All data are to be downloaded from link in description.

  • @adityagautamcs1852
    @adityagautamcs1852 26 дней назад

    Hi Baraa , ThankYOu for the amazing content. Baraa I am not able to download the resources you have provided to us(Sql Files and Presentations), whenever i click to download it opens microsoft learn page.Can you guide me with this, Thank you

  • @srinathbolla5437
    @srinathbolla5437 2 месяца назад

    hi baraa currently I am following advanced sql videos from past few days I really liked it and i also bought your tableau course nearly 25 htrs in udemy. But cant dowload this presentations because when i click that presentaion link it is directing into microsoft sql page

  • @patryh1
    @patryh1 Месяц назад

    I am using postgreesql on mac. I understand I can not use Microsoft SQL Server Management Studio. can you share the data base so i can subscribe to take the advanced sql

  • @golden_melodies
    @golden_melodies 7 месяцев назад

    Thanks alot

  • @anuboluwaji635
    @anuboluwaji635 7 месяцев назад

    Hi Baraa, hope all is well. Question: do you know MySQL and if you do, can you please do a tutorial on it?

  • @nainabansal8354
    @nainabansal8354 Месяц назад

    After identifying duplicates how can we delete those duplicate records from our table?

  • @OPTIMUSPRIME-q8x
    @OPTIMUSPRIME-q8x 4 месяца назад +1

    time to sit and learn

    • @DataWithBaraa
      @DataWithBaraa  4 месяца назад

      @@OPTIMUSPRIME-q8x good luck hope you enjoy it and don’t forget your coffee:)

  • @Sarang-g9w
    @Sarang-g9w 3 месяца назад

    brother where to find SalesDB.bak ..could you please share link .. i am trying install SQLServer.

  • @kaziabubakar7921
    @kaziabubakar7921 2 месяца назад

    please give me the data set that you have used in this tutorial. please give me.I am from Bangladesh.I like your tutorial so much.I want to practice with you that's why I need that.

  • @jacksmith4257
    @jacksmith4257 5 месяцев назад

    Whether all of this work same in MySQL server

  • @birrodossantos992
    @birrodossantos992 3 месяца назад

    Dear baraa, i think you made a mistake, the row_number should have a shared rank, and dense_rank sould have a Unique number,

  • @joewerger8845
    @joewerger8845 5 месяцев назад

    what is the letter t after the query

  • @kaziabubakar7921
    @kaziabubakar7921 2 месяца назад

    and I want your next tutorial will be is python

  • @gopikrishnasistla8896
    @gopikrishnasistla8896 7 месяцев назад

    ITALY and SQL both are beautiful only by Baraa sir.
    From sales.orders) t where rank byproduct=1
    Above query after bracket the letter t comes. What it mean
    Thank you sir

    • @DataWithBaraa
      @DataWithBaraa  7 месяцев назад +1

      Italy is very lovely and amazing culture.
      The letter t that comes after the closing bracket in your query is an alias for the subquery. In SQL, you can assign an alias to a table or a subquery to simplify references to it in the rest of your query. In SQL Server it is required to give an Alias after each subquery.

    • @gopikrishnasistla8896
      @gopikrishnasistla8896 7 месяцев назад

      @@DataWithBaraa thank you sir

  • @kaziabubakar7921
    @kaziabubakar7921 2 месяца назад

    please give me the data set that you have used in this tutorial. please give me.I am from Bangladesh.I like your tutorial so much.I want to practice with you that's why I need that.

  • @kaziabubakar7921
    @kaziabubakar7921 2 месяца назад

    please give me the data set that you have used in this tutorial. please give me.I am from Bangladesh.I like your tutorial so much.I want to practice with you that's why I need that.