mysql常用语句
2015-01-13 12:35
405 查看
SQL语句
简单的SQL语句查找:SELECT * from table1 where 范围
添加:insert into table1(列1,列2) VALUES(值1,值2)
删除:delete from table1 where 范围
更新:update table1 set username='张三' where 范围
带Like的查询:select *from table where field1 like '%value1%'
排序: select * from table1 order by field1,field2[desc]
查询共有多少条数据:select count(*)from as totable from table1;
查询出某一列的总和:select sum(price) as sumvalue from table1
查询出某一列的平均值:select avg(price) as avgvalue from table1
查询出某一列的最大值:SELECT max(price) as maxvalue from table;
查询出某一列的最小值:select min(price) as minvalue from table;