Rank and Dense Rank in MySQL – Important SQL Interview Question



Rank and Dense Rank in MySQL – Important SQL Interview Question

Rank and Dense Rank in MySQL - Important SQL Interview Question

Want to learn Big Data by Sumit Sir?
Checkout the Big Data course details here: https://link.trendytech.in/SQLtutorial

Rank and Dense Rank in MySQL – Important SQL Interview Question

In this video we will talk about how to use Rank function & Dense Rank function in SQL and its industry use case.

Remember –
We should be using the order by clause
We can also use the partition by – but its optional
the row number starts from 1 for every partition

Do Like, Comment & Subscribe ๐Ÿ™‚

๐—๐—ผ๐—ถ๐—ป ๐—บ๐—ฒ ๐—ผ๐—ป ๐—ฆ๐—ผ๐—ฐ๐—ถ๐—ฎ๐—น ๐— ๐—ฒ๐—ฑ๐—ถ๐—ฎ:๐Ÿ”ฅ
๐Ÿ”…Sumit LinkedIn – https://www.linkedin.com/in/bigdatabysumit
๐Ÿ”…Sumit Instagram – https://www.instagram.com/bigdatabysumit

Notes –

if there are no duplicates then row number, rank and dense rank lead to similar results..

only the difference comes when there are duplicates..

rank – for duplicates same rank is assigned and the for the next entry it skips the ranks..

dense rank – it does not skip any ranks in between

whenever you do not have duplicates use row_num

This is a very frequently asked SQL Interview question.

#SQL #RDBMS #database #bigdata #dataengineering

Comments are closed.