sysdate: 获取系统时间,如

    select sysdate from dual;

to_char(date, ‘format’): 将日期转换为想要的格式,如:

select to_char(sysdate, ‘yyyy-mm-dd day’) from dual;

to_date(string, ‘format’): 将字符串转换为想要的格式,如:

select to_date(‘20120615’, ‘yyyy-mm-dd’) from dual;

last_day(date): 获取date所在的月份的最后一天,如:

select last_day(sysdate) from dual;

to_number(‘string’): 将字符串类型转换成数字,如:

select to_number(‘2000’) from dual;

vsize(‘string’): 计算string的长度(所占的字符),如:

select vsize(‘abcdef’) from dual;

group by: 通常group by要与sum一起用:

select col_name, sum(col_name) from table group by col_name;

like: 用于在where子句中搜索列中的指定模式,%可用于定义通配符(模式中缺少的字母):

select * from table where col_name like ‘N%’;  (选取col_nameN开头的行)

select * from table where col_name like ‘%g’;  (选取col_nameg结尾的行)

select * from table where col_name like ‘%ab%’;  (选取col_name含有ab的行)

select * from table where col_name not like ‘%ab%’;  (选取col_name不含ab的行)

通配符% _

%匹配一个或多个字符

_匹配一个字符

in: 用于在where子句中搜索列中包含在in内的值:

    select * from table where col_name in (value1, value2……);

between andbetween start and end:用于搜索介于start(包含)end(不包含)之间的行:

    select * from table where col_name between start and end;

order by: 根据指定的列对结果集进行排序,默认按升序排序,desc按降序排列:

    select * from table t order by t.amount;

distinct: 用于去除重复行:

    select distinct col_name from table;