LeetCode 178: Rank Scores [SQL]

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • Solution and walkthrough of leetcode database problem 178: Rank Scores I'm using MySQL but this solution should work in any SQL dialect such as PostgreSQL SQL Server, etc.
    Link to the problem: leetcode.com/p...
    Check out my StrataScratch videos: • StrataScratch Coding Q...

ความคิดเห็น • 14

  • @frederikmuller
    @frederikmuller  2 ปีที่แล้ว

    If you want to have access to more free SQL problems, check out StrataScratch: stratascratch.com/?via=frederik

  • @BluEN1111
    @BluEN1111 ปีที่แล้ว +4

    select a.score, count(DISTINCT b.score) as "Rank" from Scores a join Scores b
    on a.score

  • @avahome5285
    @avahome5285 2 ปีที่แล้ว +15

    NOTES:Rank will produce 1,1,3; Dense Rank produce 1,1,2

  • @dkseo1992
    @dkseo1992 3 ปีที่แล้ว +3

    I love the second you explained. Thank you!

  • @ajaxaj6749
    @ajaxaj6749 2 ปีที่แล้ว +2

    Love the second explaination.

  • @sheharyarkhan5500
    @sheharyarkhan5500 ปีที่แล้ว

    learned a lot in this actually!!! (concept of separating table and comparison)
    thank you for your content

  • @Apocalypse-vp3kg
    @Apocalypse-vp3kg 8 หลายเดือนก่อน

    Solution 2 is good for me🐱

  • @chloewei768
    @chloewei768 3 ปีที่แล้ว +1

    Thank you!! Great video!

  • @ragnarlodhbrok1684
    @ragnarlodhbrok1684 ปีที่แล้ว

    how count function works without group by clause ....please explain,very confused...

  • @shreyagrawal3806
    @shreyagrawal3806 ปีที่แล้ว

    Helpful video

  • @davidwang8971
    @davidwang8971 2 ปีที่แล้ว

    why newly created column rank should be added with " "? thx!

  • @sujitamin949
    @sujitamin949 3 ปีที่แล้ว

    well explained