打印本文 打印本文 关闭窗口 关闭窗口
Sql精妙语句--各种求值函数
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2028  更新时间:2009/6/9 2:36:03  文章录入:mintao  责任编辑:mintao

查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料!
排序:select * from table1 order by field1,field2 [desc]
总数:select count as totalcount from table1
求和:select sum(field1) as sumvalue from table1
平均:select avg(field1) as avgvalue from table1
最大:select max(field1) as maxvalue from table1
最小:select min(field1) as minvalue from table1
根据已有的表创建新表:
A:create table tab_new like tab_old (使用旧表创建新表)
B:create table tab_new as select col1,col2… from tab_old definition only

打印本文 打印本文 关闭窗口 关闭窗口