Commit 3cf6c576 authored by 三階松隼人's avatar 三階松隼人
Browse files

SQL演習の修正したファイル

parent 38fe5d73
--select * from M_PRODUCT; --select * from M_PRODUCT;
select * from T_SALE order by procode asc; --select * from T_SALE order by procode asc;
/* /*
1.製品リストより、50,000円以下の商品に絞る 1.製品リストより、50,000円以下の商品に絞る
...@@ -15,4 +15,4 @@ select * from T_SALE order by procode asc; ...@@ -15,4 +15,4 @@ select * from T_SALE order by procode asc;
--select M_PRODUCT.procode, M_PRODUCT.proname, M_PRODUCT.price, T_SALE.number, (M_PRODUCT.price * T_SALE.number) as uriage from M_PRODUCT left join T_SALE on M_PRODUCT.procode = T_SALE.procode where price >= (select avg(price) from M_PRODUCT where price <= 50000); --select M_PRODUCT.procode, M_PRODUCT.proname, M_PRODUCT.price, T_SALE.number, (M_PRODUCT.price * T_SALE.number) as uriage from M_PRODUCT left join T_SALE on M_PRODUCT.procode = T_SALE.procode where price >= (select avg(price) from M_PRODUCT where price <= 50000);
--select sum(M_PRODUCT.price * T_SALE.number) as sou_uriage from M_PRODUCT left join T_SALE on M_PRODUCT.procode = T_SALE.procode where price >= (select avg(price) from M_PRODUCT where price <= 50000); --select sum(M_PRODUCT.price * T_SALE.number) as sou_uriage from M_PRODUCT left join T_SALE on M_PRODUCT.procode = T_SALE.procode where price >= (select avg(price) from M_PRODUCT where price <= 50000);
select M_PRODUCT.price * T_SALE.number from M_PRODUCT left join T_SALE on M_PRODUCT.procode = T_SALE.procode where price >= (select avg(price) from M_PRODUCT where price <= 50000); select sum(cast(M_PRODUCT.price * T_SALE.number as bigint)) from M_PRODUCT left join T_SALE on M_PRODUCT.procode = T_SALE.procode where price >= (select avg(price) from M_PRODUCT where price <= 50000);
--select * from M_PRODUCT; --select * from M_PRODUCT;
select * from M_PRODUCT where (price > 10000) and (cost < 50000); select * from M_PRODUCT where (price >= 10000) and (cost < 50000);
\ No newline at end of file \ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment