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