- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
SQL Window Functions | 7 Days Rolling Average Explained
we solve an important SQL interview question:
Calculate the Last 7 Days Rolling Average of sales by category.
📌 Problem Statement:
You are given daily sales data for different categories.
For each category and sales date, calculate the rolling average
of the last 7 days, including the current day.
🧠 SQL Concepts Covered:
✔ Aggregating daily sales data
✔ Handling multiple transactions per day
✔ Window Functions (ROWS BETWEEN)
✔ Rolling average calculation
✔ Real-world analytics use case
📊 The dataset includes multiple categories like Electronics and Furniture
to demonstrate practical business scenarios.
This video is especially useful for:
✅ Data Analyst Interview Preparation
✅ SQL Window Function Practice
✅ Rolling Metrics in SQL
✅ SQL Learners in India
🔔 Subscribe for more SQL interview questions, Power BI, and Data Analytics content.
LINKEDIN : https://www.linkedin.com/in/imratankj/
WHATSAPP COMMUNITY: https://lnkd.in/eMSZJzqR
𝗙𝗼𝗹𝗹𝗼𝘄 𝘁𝗵𝗶𝘀 𝗹𝗶𝗻𝗸 𝘁𝗼 𝗷𝗼𝗶𝗻 𝘁𝗵𝗲 𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘀𝘁 𝗕𝗮𝘀𝗶𝗰 𝘁𝗼 𝗔𝗱𝘃𝗮𝗻𝗰𝗲 𝗕𝗮𝘁𝗰𝗵 𝗪𝗵𝗮𝘁𝘀𝗔𝗽𝗽 𝗚𝗿𝗼𝘂𝗽: https://lnkd.in/eMSZJzqR
----------------------------------------------------------------------------------------------------
📌 SQL Question: Last 7 Days Rolling Average
Question Statement
You are given a table that stores daily sales data for different categories.
Task:
For each category and sales date, calculate the rolling
average sales of the last 7 days, including the current day.
CREATE TABLE daily_sales (
sale_date DATE,
category VARCHAR(50),
sales_amount INT
);
INSERT INTO daily_sales VALUES
-- Electronics
('2024-01-01', 'Electronics', 1000),
('2024-01-01', 'Electronics', 500),
('2024-01-02', 'Electronics', 1200),
('2024-01-03', 'Electronics', 1100),
('2024-01-04', 'Electronics', 1500),
('2024-01-05', 'Electronics', 1300),
('2024-01-05', 'Electronics', 900),
('2024-01-06', 'Electronics', 1600),
('2024-01-06', 'Electronics', 600),
('2024-01-07', 'Electronics', 1700),
('2024-01-08', 'Electronics', 1800),
('2024-01-09', 'Electronics', 1900),
-- Furniture
('2024-01-01', 'Furniture', 800),
('2024-01-02', 'Furniture', 900),
('2024-01-03', 'Furniture', 850),
('2024-01-04', 'Furniture', 950),
('2024-01-04', 'Furniture', 750),
('2024-01-05', 'Furniture', 1000),
('2024-01-06', 'Furniture', 1100),
('2024-01-07', 'Furniture', 1200),
('2024-01-07', 'Furniture', 200),
('2024-01-08', 'Furniture', 1250),
('2024-01-09', 'Furniture', 1300);
🔔 Subscribe for more SQL interview questions, Power BI, and Data Analytics content.
Видео SQL Window Functions | 7 Days Rolling Average Explained канала DecodeWithRatan
Calculate the Last 7 Days Rolling Average of sales by category.
📌 Problem Statement:
You are given daily sales data for different categories.
For each category and sales date, calculate the rolling average
of the last 7 days, including the current day.
🧠 SQL Concepts Covered:
✔ Aggregating daily sales data
✔ Handling multiple transactions per day
✔ Window Functions (ROWS BETWEEN)
✔ Rolling average calculation
✔ Real-world analytics use case
📊 The dataset includes multiple categories like Electronics and Furniture
to demonstrate practical business scenarios.
This video is especially useful for:
✅ Data Analyst Interview Preparation
✅ SQL Window Function Practice
✅ Rolling Metrics in SQL
✅ SQL Learners in India
🔔 Subscribe for more SQL interview questions, Power BI, and Data Analytics content.
LINKEDIN : https://www.linkedin.com/in/imratankj/
WHATSAPP COMMUNITY: https://lnkd.in/eMSZJzqR
𝗙𝗼𝗹𝗹𝗼𝘄 𝘁𝗵𝗶𝘀 𝗹𝗶𝗻𝗸 𝘁𝗼 𝗷𝗼𝗶𝗻 𝘁𝗵𝗲 𝗗𝗮𝘁𝗮 𝗔𝗻𝗮𝗹𝘆𝘀𝘁 𝗕𝗮𝘀𝗶𝗰 𝘁𝗼 𝗔𝗱𝘃𝗮𝗻𝗰𝗲 𝗕𝗮𝘁𝗰𝗵 𝗪𝗵𝗮𝘁𝘀𝗔𝗽𝗽 𝗚𝗿𝗼𝘂𝗽: https://lnkd.in/eMSZJzqR
----------------------------------------------------------------------------------------------------
📌 SQL Question: Last 7 Days Rolling Average
Question Statement
You are given a table that stores daily sales data for different categories.
Task:
For each category and sales date, calculate the rolling
average sales of the last 7 days, including the current day.
CREATE TABLE daily_sales (
sale_date DATE,
category VARCHAR(50),
sales_amount INT
);
INSERT INTO daily_sales VALUES
-- Electronics
('2024-01-01', 'Electronics', 1000),
('2024-01-01', 'Electronics', 500),
('2024-01-02', 'Electronics', 1200),
('2024-01-03', 'Electronics', 1100),
('2024-01-04', 'Electronics', 1500),
('2024-01-05', 'Electronics', 1300),
('2024-01-05', 'Electronics', 900),
('2024-01-06', 'Electronics', 1600),
('2024-01-06', 'Electronics', 600),
('2024-01-07', 'Electronics', 1700),
('2024-01-08', 'Electronics', 1800),
('2024-01-09', 'Electronics', 1900),
-- Furniture
('2024-01-01', 'Furniture', 800),
('2024-01-02', 'Furniture', 900),
('2024-01-03', 'Furniture', 850),
('2024-01-04', 'Furniture', 950),
('2024-01-04', 'Furniture', 750),
('2024-01-05', 'Furniture', 1000),
('2024-01-06', 'Furniture', 1100),
('2024-01-07', 'Furniture', 1200),
('2024-01-07', 'Furniture', 200),
('2024-01-08', 'Furniture', 1250),
('2024-01-09', 'Furniture', 1300);
🔔 Subscribe for more SQL interview questions, Power BI, and Data Analytics content.
Видео SQL Window Functions | 7 Days Rolling Average Explained канала DecodeWithRatan
SQLInterviewQuestions 7DaysRollingAverage DataAnalystSQL SQLForDataAnalyst AdvanceSQlquestion AnalyticsInterview LearnSQL Last7daysrollingavg sql Advancesqlquestion dataanalyticssqladvancequestion DataAnalystAdvanceAQlConcept Data analyst SQL interview India 30 days SQL challenge Advanced SQL window functions Learn SQL step by step Rolling average SQL query SQL real world problems SQL interview preparation India SQL queries for experienced SQL for business analytics
Комментарии отсутствуют
Информация о видео
26 января 2026 г. 18:14:08
00:09:04
Другие видео канала





