- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
SQL Advanced Interview Series - Running Total of Sales #sql #dataanalytics
In this video, we dive deep into an advanced SQL interview question: How to calculate the running total of sales per product, ordered by sale date? 🚀
✅ What you’ll learn:
Writing SQL queries for cumulative totals
Using window functions (SUM OVER) for efficient calculations
Handling partitioning and ordering to segment data properly
📌 Tables used: sales, products
📌 Key Concepts: SUM() OVER(), PARTITION BY, ORDER BY
Table Script:
CREATE TABLE products (
product_id INT PRIMARY KEY,
product_name VARCHAR(100)
);
CREATE TABLE sales (
sale_id INT PRIMARY KEY,
product_id INT,
sale_date DATE,
sales_amount DECIMAL(10,2),
FOREIGN KEY (product_id) REFERENCES products(product_id)
);
INSERT INTO products (product_id, product_name) VALUES
(101, 'Laptop'),
(102, 'Mobile');
INSERT INTO sales (sale_id, product_id, sale_date, sales_amount) VALUES
(1, 101, '2024-03-01', 500),
(2, 102, '2024-03-02', 300),
(3, 101, '2024-03-03', 700),
(4, 102, '2024-03-04', 400),
(5, 101, '2024-03-05', 600);
SELECT * FROM products
SELECT * FROM sales
Subscribe for more SQL interview questions and real-world use cases!
#Dataanalytics #SQL #PowerBI #DataScience #DataEngineering #Sales
Видео SQL Advanced Interview Series - Running Total of Sales #sql #dataanalytics канала AI Data Simplified
✅ What you’ll learn:
Writing SQL queries for cumulative totals
Using window functions (SUM OVER) for efficient calculations
Handling partitioning and ordering to segment data properly
📌 Tables used: sales, products
📌 Key Concepts: SUM() OVER(), PARTITION BY, ORDER BY
Table Script:
CREATE TABLE products (
product_id INT PRIMARY KEY,
product_name VARCHAR(100)
);
CREATE TABLE sales (
sale_id INT PRIMARY KEY,
product_id INT,
sale_date DATE,
sales_amount DECIMAL(10,2),
FOREIGN KEY (product_id) REFERENCES products(product_id)
);
INSERT INTO products (product_id, product_name) VALUES
(101, 'Laptop'),
(102, 'Mobile');
INSERT INTO sales (sale_id, product_id, sale_date, sales_amount) VALUES
(1, 101, '2024-03-01', 500),
(2, 102, '2024-03-02', 300),
(3, 101, '2024-03-03', 700),
(4, 102, '2024-03-04', 400),
(5, 101, '2024-03-05', 600);
SELECT * FROM products
SELECT * FROM sales
Subscribe for more SQL interview questions and real-world use cases!
#Dataanalytics #SQL #PowerBI #DataScience #DataEngineering #Sales
Видео SQL Advanced Interview Series - Running Total of Sales #sql #dataanalytics канала AI Data Simplified
ProductAnalytics DataScience DataAnalytics MachineLearning AI SQL Python BigData BusinessIntelligence Analytics PowerBI Tableau DataVisualization PredictiveAnalytics DataDriven GoogleAnalytics DataAnalyst ABTesting CustomerAnalytics DataInsights DataScienceProjects SQLTutorial PythonForDataScience DataAnalystProject Data DataProjects SQLinterviewquestions SQLdata
Комментарии отсутствуют
Информация о видео
27 марта 2025 г. 17:54:23
00:09:10
Другие видео канала




















