SELECT p.productCode, p.productName, (p.MSRP-p.buyPrice) * od.quantityOrdered AS Profit_1, (od.priceEach-p.buyPrice) * od.quantityOrdered AS Profit_2, (SELECT (Profit_1 - Profit_2)) AS Different, (SELECT IF(SUBSTR(p.productName, 1, 4) < 1940, 'Group 1', 'Group 2')) AS Group_ FROM classicmodels.products p JOIN classicmodels.orderdetails od ON od.productCode = p.productCode GROUP BY p.productCode ORDER BY Different DESC;
SELECT pl.productLine, pl.textDescription, sum(od.quantityOrdered) + (
SELECT sum(quantityInStock)
FROM classicmodels.products
WHERE productLine = pl.productLine) AS total_quantity_of_products
FROM classicmodels.orderdetails od
JOIN classicmodels.products p ON od.productCode = p.productCode
JOIN classicmodels.productlines pl on p.productLine = pl.productLine
GROUP BY pl.productLine
HAVING total_quantity_of_products > 60000
ORDER BY total_quantity_of_products DESC;
select c.* , (select sum(od.quantityOrdered*od.priceEach) from classicmodels.orders o join classicmodels.orderdetails od on o.orderNumber = od.orderNumber where o.customerNumber = c.customerNumber) as total_ordered, (select sum(p.amount) from classicmodels.payments p where p.customerNumber = c.customerNumber) as total_payment, (select total_ordered - total_payment) as total_debt, (SELECT total_debt/total_ordered) AS debt_purchase_ratio from classicmodels.customers c group by c.customerName HAVING debt_purchase_ratio >= 0.3;
@TanLm thứ nhất là người thứ 5 nếu muốn sống thì đoán 1 trong 2 số 4 và 5, 50% sống hoặc chết chứ k chắc chắn sống.
Thứ 2 là muốn chắc chắn cứu đc nhiều người nhất, nên người thứ 5 hy sinh để 4 người còn lại sống thôi.
Đây là case 5 người, chứ case 100 hay 1000 người cũng vậy, hy sinh 1 người để 99 hoặc 999 người còn lại sống.
SELECT pl.*, COUNT(o.orderNumber) AS total_cancellation
FROM classicmodels.orders o
JOIN classicmodels.orderdetails od ON od.orderNumber = o.orderNumber
JOIN classicmodels.products p ON p.productCode = od.productCode
JOIN classicmodels.productlines pl ON pl.productLine = p.productLine
WHERE o.status = 'Cancelled' AND o.orderDate BETWEEN '2004-01-01' AND '2004-12-31'
GROUP BY pl.productLine
ORDER BY total_cancellation DESC
LIMIT 3;
@longcb dạ cảm ơn a
(với nginx-ingress thì còn phải tự describe port trong cấu hình service trên rancher như sau) phần này a làm trong file nào ạ, a hướng dẫn giúp em với ạ
THẢO LUẬN
@tuana9a thanks bác
đây là 1 cái link ,ấn vào đăng ký tài khoản phải cần có mã mời anh có thể bớt chút tg xem dùm em đc ko ạ zl em 0968102462
Thi thoảng mình vào clear hết image của docker, vừa dọn dc cả những image outdate lâu ngày ko dùng, trống dc nhiều.
SELECT p.productCode, p.productName, (p.MSRP-p.buyPrice) * od.quantityOrdered AS Profit_1, (od.priceEach-p.buyPrice) * od.quantityOrdered AS Profit_2, (SELECT (Profit_1 - Profit_2)) AS Different, (SELECT IF(SUBSTR(p.productName, 1, 4) < 1940, 'Group 1', 'Group 2')) AS Group_ FROM classicmodels.products p JOIN classicmodels.orderdetails od ON od.productCode = p.productCode GROUP BY p.productCode ORDER BY Different DESC;
@1337willows đã fix
@1337willows đã fix
ảo thật đấy. huhu
SELECT pl.productLine, pl.textDescription, sum(od.quantityOrdered) + ( SELECT sum(quantityInStock) FROM classicmodels.products WHERE productLine = pl.productLine) AS total_quantity_of_products FROM classicmodels.orderdetails od JOIN classicmodels.products p ON od.productCode = p.productCode JOIN classicmodels.productlines pl on p.productLine = pl.productLine GROUP BY pl.productLine HAVING total_quantity_of_products > 60000 ORDER BY total_quantity_of_products DESC;
@nguyenthanhnamtb2002 looix syntax
@nguyenthanhnamtb2002 thiếu 2004
select c.* , (select sum(od.quantityOrdered*od.priceEach) from classicmodels.orders o join classicmodels.orderdetails od on o.orderNumber = od.orderNumber where o.customerNumber = c.customerNumber) as total_ordered, (select sum(p.amount) from classicmodels.payments p where p.customerNumber = c.customerNumber) as total_payment, (select total_ordered - total_payment) as total_debt, (SELECT total_debt/total_ordered) AS debt_purchase_ratio from classicmodels.customers c group by c.customerName HAVING debt_purchase_ratio >= 0.3;
@TanLm thứ nhất là người thứ 5 nếu muốn sống thì đoán 1 trong 2 số 4 và 5, 50% sống hoặc chết chứ k chắc chắn sống. Thứ 2 là muốn chắc chắn cứu đc nhiều người nhất, nên người thứ 5 hy sinh để 4 người còn lại sống thôi. Đây là case 5 người, chứ case 100 hay 1000 người cũng vậy, hy sinh 1 người để 99 hoặc 999 người còn lại sống.
SELECT pl.*, COUNT(o.orderNumber) AS total_cancellation FROM classicmodels.orders o JOIN classicmodels.orderdetails od ON od.orderNumber = o.orderNumber JOIN classicmodels.products p ON p.productCode = od.productCode JOIN classicmodels.productlines pl ON pl.productLine = p.productLine WHERE o.status = 'Cancelled' AND o.orderDate BETWEEN '2004-01-01' AND '2004-12-31' GROUP BY pl.productLine ORDER BY total_cancellation DESC LIMIT 3;
Tks e, mục tiêu của a là cố gắng truyền tải để mọi người dễ hiểu nhất có thể 😁. Những bài khác có phần nào khó hiểu em có thể comment nha
@longcb dạ cảm ơn a (với nginx-ingress thì còn phải tự describe port trong cấu hình service trên rancher như sau) phần này a làm trong file nào ạ, a hướng dẫn giúp em với ạ
Cảm ơn anh đã chia sẻ
minh cung thay vay
Bài viết hay quá
@zzz anh có thể giúp đỡ em đc ko ạ