A Genuine Use Case of DENSE RANK over RANK | RANK vs Dense RANK | Data Analytics

preview_player
Показать описание
In this video we will cover a real use case where we need to use dense rank over rank.

Zero to hero(Advance) SQL Aggregation:

Most Asked Join Based Interview Question:

Solving 4 Trick SQL problems:

Data Analyst Spotify Case Study:

Top 10 SQL interview Questions:

Interview Question based on FULL OUTER JOIN:

Playlist to master SQL :

Rank, Dense_Rank and Row_Number:
script:
create table product_inventory_fact
(
product_id varchar(10),
quantity integer,
snapshot_date date
)
insert into product_inventory_fact
values ('ITEM1',10,'2022-08-01'),('ITEM2',14,'2022-08-01')
,('ITEM1',10,'2022-08-02'),('ITEM2',12,'2022-08-02')
,('ITEM1',5,'2022-08-03'),('ITEM2',6,'2022-08-03'),('ITEM3',6,'2022-08-03')
,('ITEM1',10,'2022-08-04'),('ITEM2',9,'2022-08-04'),('ITEM3',3,'2022-08-04'),('ITEM4',8,'2022-08-04')

#sql #dataengineer
Рекомендации по теме
Комментарии
Автор

My zero to hero SQL course starts from Nov 22nd. Book your seat from below link :

use code ANKIT10 for discount.

ankitbansal
Автор

Hello Ankit,

Can you check this query:
select *
from (
select *,
rank() OVER(PARTITION BY product_id ORDER BY snapshot_date desc) as drn
from product_inventory_fact
)A
where drn <= 2
ORDER BY drn, product_id;

pragnyanakka
Автор

Hi Ankit Sir!.
Please make a end to end project for data analyst!
Thankyou!

ajaydalvi
Автор

can you explain in channel regarding employee can start date and close date perform the average time ? and about average rating it will be useful

sugan
Автор

This does make sense,

Thanks a lot sir🙏

avi
Автор

Hello Ankit Sir. Aren't there SQL important questions like there are cracker sheets for SWE roles?

inspiredomkar
Автор

For the same question, Can we go ahead with rownum() instead of dense_rank() ?

BI-Rahul
Автор

hi Ankit i have a sql query problem please let me know how i can share it with you

Progressivethoughts
Автор

Hi Ankit, I want join your Sql course, can you please share link...

vijaysingh-hwsj