练习题1
select product_name,regist_date from product where regist_date>'2009-4-28';
练习题2
1.查询结果返回purchase_price为空的数据
2.查询结果返回purchase_price不为空的数据
3.查询结果返回purchase_price非空的数据
练习题3
select product_name,sale_price,purchase_price from product where sale_price-purchase_price>=500;
select product_name,sale_price,purchase_price from product having sale_price-purchase_price>=500;
练习题4
select product_name,product_type,saleprice*0.9 - purchase_price as profit from product saleprice*0.9 - purchase_price > 100
and product_type in ('办公用品','厨房用具');
练习题5
where执行在前,group by执行在后
练习题6
select product_type,sum(sale_price) sale_sum,sum(purchase_price) purchase_sum from product where sum(sale_price) >sum(purchase_price)*1.5
group by product_type;
练习题7
select * from product where regist_date order by regist_date desc;