简单SQL操作
以前学SQL的时候,只会简单的增删查改,然后什么课设,毕设都是增删查改,想想好智障~
1.从表中选取出不同的值
select distinct company from order;
2.返回列的最大值
select MAX(column_name) from table_name;
3.返回某列信息的不同值的最大值
select * from ( select food,max(prince) prince from order group by food )order;
4.周六日的平均气温
select AVG(meantempi) from( select * from weather_date where cast(strftime ('%w',date) as integer) IN (6,0) )weather_date;
5.找出平均气温大于55是雨天的平均最低气温
select AVG(mintempi) from( select * from weather_data where mintempi > 55 and rain = 1 )weather_data;