Uber SQL Interview Question | Find User's third transaction | SQL Window Functions | Advanced SQL

  Рет қаралды 3,596

Nishtha Nagar

Nishtha Nagar

Күн бұрын

Пікірлер: 24
@shettygarusairam166
@shettygarusairam166 3 ай бұрын
Your explanation is clear
@akshaykodekal8483
@akshaykodekal8483 3 ай бұрын
Very clearly and calmly explained
@gospelmoto2833
@gospelmoto2833 5 ай бұрын
I learned a new thing! Thanks!
@badrilalnagar9232
@badrilalnagar9232 6 ай бұрын
Always smiling is a priceless quality of life.
@prajju8114
@prajju8114 5 ай бұрын
with cte_trans as ( select [user_id],[spend],[transaction_date],dense_rank() OVER(partition by user_id order by transaction_date) as transaction_s from transactions ) Select * from cte_trans where transaction_s=3
@yousfimohamed3999
@yousfimohamed3999 3 күн бұрын
with cte as (select *,row_number() over(partition by user_id order by transaction_date ) as rn from transactionsss ) select user_id,spend,transaction_date from cte where rn = 3
@AnandBabu-e5n
@AnandBabu-e5n 5 ай бұрын
with uber as ( select *, row_number() over(partition by id) as rn from uberdata ) select * from uber where rn % 3 =0; I think we need to fetch every 3 rd transaction in table. may be we need to modify like above
@astech4407
@astech4407 4 ай бұрын
it is the third transaction partition by id where order by ?
@ajaycheryala7760
@ajaycheryala7760 6 ай бұрын
Thanks for the script
@tilu391
@tilu391 5 ай бұрын
with cte as (select user_id,spend,transaction_date,rank() over(partition by user_id order by transaction_date) as rnk from transactions) select user_id,spend,transaction_date from cte where rnk =3;
@aditi_shetti
@aditi_shetti 4 ай бұрын
My take on the question where I have used dense_rank instead of row_number with cte1 as ( select user_id, spend, transaction_date , dense_rank() over(partition by user_id order by transaction_date) as dense_rn from transactions_1 ) select user_id, spend, transaction_date from cte1 where dense_rn = 3
@luckilygamer5462
@luckilygamer5462 Ай бұрын
My Approach: select user_id,spend,transaction_date from( select user_id, spend, transaction_date, row_number() over( partition by user_id order by transaction_date) as rnk from transactions) asa where rnk=3
@Savenature635
@Savenature635 4 ай бұрын
with cte as (select *,dense_rank() over(partition by user_id order by transaction_date asc) as rnk from uber_transactions) select user_id,spend,transaction_date from cte where rnk=3;
@prajju8114
@prajju8114 5 ай бұрын
I used dense_rank and got the same output
@Spiritual_Talks2001
@Spiritual_Talks2001 5 ай бұрын
third transaction of every user: Select * From (Select t1.user_id From Transaction t Where 3= (Select Count(DISTINCT (t2. user_id)) from Transaction where t2.user_id>=t1.user_id group by user_id ) );
@RahulR-zm1ug
@RahulR-zm1ug 6 ай бұрын
Hey you contant very useful but you more details SQL full course and main domain use it company details python
@hairavyadav6579
@hairavyadav6579 5 ай бұрын
i think script is wrong the your date format is year/date/month because i facing problem at the time of inserting value. so please correct this thing in correct format in mysql fromat is -- year/month/date.
@datasciencewithnish
@datasciencewithnish 5 ай бұрын
You're correct. The date format in MySQL should be year/month/day. I’ve corrected the script to follow the correct format. Big thanks for noticing it!
@hairavyadav6579
@hairavyadav6579 5 ай бұрын
@@datasciencewithnish Thanks ... Sometimes it happens by mistake.... But thank you for making valuable content
@samyukthashanmugam7516
@samyukthashanmugam7516 4 ай бұрын
WITH cte AS ( SELECT user_id, spend, transaction_date, ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY transaction_date ASC) AS user_trans FROM transactions ) SELECT * FROM cte WHERE user_trans = 3 ORDER BY user_id;
@theinsightminer08
@theinsightminer08 3 ай бұрын
SELECT user_id, spend, transaction_date FROM (SELECT *,ROW_NUMBER() OVER(PARTITION BY user_id ORDER BY transaction_date) AS rn FROM transactions) subquery WHERE rn = 3;
@MubarakAli-qs9qq
@MubarakAli-qs9qq 5 ай бұрын
Can u do it by CTE
@AnandBabu-e5n
@AnandBabu-e5n 5 ай бұрын
with uber as ( select *, row_number() over(partition by id) as rn from uberdata ) select * from uber where rn % 3 =0; Please find the cte expression
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Bow is still AWESOME | Arkveld Bow Solo - MHWilds Beta
12:53
Walmart SQL Interview Question | SQL Window Functions | Advanced
11:31
Zomato SQL Interview Question | Using CTEs | Advanced SQL
14:37
Nishtha Nagar
Рет қаралды 17 М.
Target SQL Interview Question | Using Sub-query | Level - MEDIUM
11:16
SQL Window Functions in 10 Minutes
10:13
Colt Steele
Рет қаралды 97 М.