D33
D33
--1)Write an SQL query to retrieve the sum of sales and profit for all products in
the "Coffee_Chain_Sales" dataset.
SELECT
product,
SUM(sales) AS total_sales,
SUM(profit) AS total_profit
FROM Cofee
GROUP BY product
ORDER BY total_sales DESC;
--2)Write an SQL query to retrieve the total sales and profit for each state in the
"Coffee_Chain_Sales" dataset.
--3)Write an SQL query to retrieve the sales and profit for all products in the
"Coffee_Chain_Sales" dataset where the profit is negative.
--4)Write an SQL query to retrieve the sales and profit for all products in the
"Coffee_Chain_Sales" dataset where the sales exceed the target sales.
--5)Write an SQL query to retrieve the sales and profit for all products in the
"Coffee_Chain_Sales" dataset sorted by the product type in ascending order.
--6)Write an SQL query to retrieve the sales and profit for all products in the
"Coffee_Chain_Sales" dataset where the sales are greater than 100 and the profit is
less than 0.
--9)Write an SQL query to retrieve the sales and profit for all products in the
"Coffee_Chain_Sales" dataset where the product name ends with the letter "n."