SQL Famous Interview Question - Year on Year Growth | Lag|

  Рет қаралды 613

GeekCoders

GeekCoders

Күн бұрын

drop table tableA;
create TABLE tableA
(
Tenant varchar(20),
Year INT,
sales float
)
insert into tableA values
('tenant 1',2014,2000.00),
('tenant 1',2015,5000.00),
('tenant 2',2013,1000.00),
('tenant 2',2014,1500.00),
('tenant 2',2015,800.00)
select t.*, ((t.sales-t.last_year_sales)/t.last_year_sales)*100 as YoY from
(
select *,lag(sales,1) over (partition by tenant order by year) as last_year_sales from tableA
) t
Check out my course here: www.geekcoders...
#sqlinterview #sqlinterviewquestionsandanswers #dataengineering

Пікірлер: 4
@mohanprasath1781
@mohanprasath1781 Ай бұрын
Today I planned to learn the YOY concept, I found your video notification. Thanks
@GeekCoders
@GeekCoders Ай бұрын
@@mohanprasath1781 thank you sir
@nikhilbhardwaj3211
@nikhilbhardwaj3211 Ай бұрын
Bhai , Please help me I am in confusion. My current package in Gurgaon is 12.5 Getting offer of 18+3 from mumbai , should I join
@GeekCoders
@GeekCoders Ай бұрын
@@nikhilbhardwaj3211 rent in Mumbai is very high. Look for other job until your notice period end
Walmart PySpark Interview Question | Data Engineering |
15:04
GeekCoders
Рет қаралды 2 М.
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 33 МЛН
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 72 МЛН
Infosys SQL Interview Question
9:23
Cloud Challengers
Рет қаралды 20 М.
Top 6 Coding Interview Concepts (Data Structures & Algorithms)
10:51
The Sad Reality of Being a Data Scientist
8:55
Samson Afolabi
Рет қаралды 70 М.
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26