From 150f2e9c834b35c90df5262f9b7ee3096a154478 Mon Sep 17 00:00:00 2001 From: Abinesh S <221201002@rajalakshmi.edu.in> Date: Sun, 21 Sep 2025 20:51:14 +0530 Subject: [PATCH] Update 27_online_shop.sql --- 4-multiple-tables/27_online_shop.sql | 34 +++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/4-multiple-tables/27_online_shop.sql b/4-multiple-tables/27_online_shop.sql index 46d5457..7292fed 100644 --- a/4-multiple-tables/27_online_shop.sql +++ b/4-multiple-tables/27_online_shop.sql @@ -1,4 +1,36 @@ -- Online Shop 🛍️ -- Codédex +-- Write code below 💖 +select * from orders; +select * from products; +select * from customers; + +select * from products +where inventory <=50; + +select * from products +where inventory >50; + + +SELECT orders.id as order_id, +orders.date, +customers.name as customer, +products.name as product +from orders +join customers + on orders.customer_id = customers.id +join products + on orders.customer_id= products.id +where orders.fulfilled =1 +order by orders.date; + + +SELECT +date,SUM(products.price) AS total_sales +FROM orders +JOIN products + ON orders.item_id = products.id +WHERE orders.fulfilled = 1 -- count only fulfilled orders +GROUP BY orders.date +ORDER BY total_sales DESC; --- No solution for this one yet! :) \ No newline at end of file