Find the products whose total sales has increased every year | Data Engineer Interview | Deloitte

preview_player
Показать описание
If you like this video please do like,share and subscribe my channel.

1 Subscriber, 1👍🏻, 1Comment = 100 Motivation 🙏🏼
🙏🏻Please Subscribe 🙏🏼

#pyspark #databricks #dataengineers #python #job #interview #questions #cognitivecoders
Рекомендации по теме
Комментарии
Автор

good one keep it up i am following you

avibitm
Автор

This is really amazing video and please keep it up

anandgupta
Автор

WITH cte AS (
SELECT p.product_id, p.product_name, p.category,
s.total_sales_revenue AS year_1_revenue,
LEAD(total_sales_revenue, 1) OVER (PARTITION BY product_id ORDER BY year) AS year_2_revenue,
LEAD(total_sales_revenue, 2) OVER (PARTITION BY product_id ORDER BY year) AS year_3_revenue
FROM products p JOIN sales s ON p.product_id = s.product_id
)
SELECT product_id, product_name, category
FROM cte
WHERE year_1_revenue < year_2_revenue < year_3_revenue;

sabesanj