Last active
July 3, 2023 12:21
-
-
Save FromMeloriWithLove/fa7b8345afb23d0f5fefc17fd8a63cd1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2. | |
SELECT c.name, SUM(price * quantity) AS TotalSales | |
FROM Category c | |
JOIN Product p ON c.id = p.id_category | |
WHERE c.name IN ('Мясные', 'Хлебо-булочные') | |
GROUP BY c.name | |
3. | |
SELECT s.name, MIN(d.price * d.quantity) AS Minn | |
FROM Delivery d | |
JOIN Supplier s ON s.id = d.id_supplier | |
WHERE date_of_delivery BETWEEN DATEADD(MONTH, -30, GETDATE()) AND GETDATE() | |
GROUP BY s.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment