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.