Homework 5 task 3 - rebing/POS GitHub Wiki
Note. reavahetused on siin githubis segased
1) esimene query (muidugi funktsioonidega oleks see palju puhtam)
select stockitem.name, -- sold quantity (select sum(solditem.quantity) from soldItem where stockitem_id = stockitem.id) as sold_quantity, stockitem.price as price, -- total price (select sum(solditem.quantity) from soldItem where stockitem_id = stockitem.id) * stockitem.price as sold_total_price from stockitem where -- nullid ajavavd orderi sassi, eemaldada tuleb (select sum(quantity) from soldItem where stockitem_id = stockitem.id) is not null order by sold_total_price desc limit 1
2) teine query
select date, -- summa (select sum(price) from order as table1 where table1.date = order.date) as total from order order by total desc limit 1