Тёмный

Want to Master SQL? Learn the Top Window Functions for Success Now | SQL Window functions 

SQL Coder
Подписаться 2,5 тыс.
Просмотров 76
50% 1

Опубликовано:

 

29 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 4   
@RamaKrishna-z3z
@RamaKrishna-z3z 19 дней назад
Hi Sir , Small correction is needed . ROWS BETWEEN 2 PRECEDING AND CURRENT ROW This specifies that the moving window includes the current row and the two previous rows (i.e., the last 3 orders, including the current one). But in the video moving_avg_for last 3 orders ROWS BETWEEN 3 PRECEDING AND CURRENT ROW is used
@SQLCoder
@SQLCoder 19 дней назад
Thanks for the feedback!
@RamaKrishna-z3z
@RamaKrishna-z3z 19 дней назад
Good explanation sir. Please provide source data/DDL. Thanks for sharing the code .
@SQLCoder
@SQLCoder 19 дней назад
Ok, please use the below code. 'CREATE TABLE `customers` ( `cust_id` int NOT NULL, `cust_name` varchar(45) NOT NULL, `date_of_birth` date DEFAULT NULL, `country` varchar(45) DEFAULT NULL, `created_date` datetime DEFAULT NULL, PRIMARY KEY (`cust_id`), UNIQUE KEY `cust_id_UNIQUE` (`cust_id`) ) ; 'CREATE TABLE `orderdetail` ( `item_id` int DEFAULT NULL, `order_id` int DEFAULT NULL, `product_id` int DEFAULT NULL, `selling_price` int DEFAULT NULL, `discount` int DEFAULT NULL, `quantity` int DEFAULT NULL, KEY `fk_order_id` (`order_id`), CONSTRAINT `fk_order_id` FOREIGN KEY (`order_id`) REFERENCES `orders` (`order_id`) ) 'CREATE TABLE `orders` ( `order_id` int NOT NULL, `cust_id` int DEFAULT NULL, `order_date` datetime DEFAULT NULL, `ship_date` datetime DEFAULT NULL, `payment_mode` varchar(50) DEFAULT NULL, `created_date` datetime DEFAULT NULL, PRIMARY KEY (`order_id`), KEY `fk_cust_id` (`cust_id`), CONSTRAINT `fk_cust_id` FOREIGN KEY (`cust_id`) REFERENCES `customers` (`cust_id`) )
Далее
Window Functions in MySQL | Intermediate MySQL
13:29
Просмотров 84 тыс.
14-Year-Old Prodigy Programmer Dreams In Code
8:42
Просмотров 12 млн
SQL Views Tutorial | VIEWS in SQL Complete Tutorial
43:20
CS50 Lecture by Mark Zuckerberg - 7 December 2005
1:05:35
Learn SQL In 60 Minutes
56:24
Просмотров 2,1 млн