ขนาดวิดีโอ: 1280 X 720853 X 480640 X 360
แสดงแผงควบคุมโปรแกรมเล่น
เล่นอัตโนมัติ
เล่นใหม่
great explanation sir thank you so much
Thanks a lot for this playlist❤
we also can use date_format(order_date, yyyy-mm) to group by
LeetCode prime Q/A
select left(order_date, 7) as month, count( order_id ) as order_count, count(distinct customer_id) as customer_countfrom Orderswhere invoice>20group by left(order_date, 7)
30
CREATE TABLE Orders ( order_id INT, order_date DATE, customer_id INT, invoice INT);INSERT INTO Orders (order_id, order_date, customer_id, invoice) VALUES(1, '2020-09-15', 1, 30),(2, '2020-09-17', 2, 90),(3, '2020-10-06', 3, 20),(4, '2020-10-20', 3, 21),(5, '2020-11-10', 1, 10),(6, '2020-11-21', 2, 15),(7, '2020-12-01', 4, 55),(8, '2020-12-03', 4, 77),(9, '2021-01-07', 3, 31),(10, '2021-01-15', 2, 20);SELECT SUBSTRING(order_date,1,7) AS month ,COUNT(*) AS order_count,COUNT(DISTINCT customer_id) AS customer_countFROM OrdersWHERE invoice>20GROUP BY SUBSTRING(order_date,1,7)
Thanks bro
great explanation sir thank you so much
Thanks a lot for this playlist❤
we also can use date_format(order_date, yyyy-mm) to group by
LeetCode prime Q/A
select left(order_date, 7) as month,
count( order_id ) as order_count,
count(distinct customer_id) as customer_count
from Orders
where invoice>20
group by left(order_date, 7)
30
CREATE TABLE Orders (
order_id INT,
order_date DATE,
customer_id INT,
invoice INT
);
INSERT INTO Orders (order_id, order_date, customer_id, invoice) VALUES
(1, '2020-09-15', 1, 30),
(2, '2020-09-17', 2, 90),
(3, '2020-10-06', 3, 20),
(4, '2020-10-20', 3, 21),
(5, '2020-11-10', 1, 10),
(6, '2020-11-21', 2, 15),
(7, '2020-12-01', 4, 55),
(8, '2020-12-03', 4, 77),
(9, '2021-01-07', 3, 31),
(10, '2021-01-15', 2, 20);
SELECT SUBSTRING(order_date,1,7) AS month ,COUNT(*) AS order_count,COUNT(DISTINCT customer_id) AS customer_count
FROM Orders
WHERE invoice>20
GROUP BY SUBSTRING(order_date,1,7)
Thanks bro