oracle 的常见语句

查询:

  普通查询:

    select * from userlist;

  条件查询:

    select * from userlist where name = '张三';

  删除重复项:

    select distinct(name) from userlist ;

  取前N行:

    select *,rownum from userlist where rownum <=N;

  排序:

    select * from userlist order by id desc; 降序

    select * from userlist order by id asc;升序

  改变显示:

    select id,name,decode(status,'N','未确定','Y','已确定') from userlist

  日期操作:

    select trunc(sysdate) from dual

  长度计算:

    select name,length(name) from TEST 

新增:

    insert into userlist(id,name,birthday,operator,sysdate)values(1,'张三','2014-01-01','李四')

更新:

    update userlist set id = '2' where name = '张三'

复制:

    create table new_test as select * from old_table where 1=1

 

posted @ 2014-01-27 10:23  Derek1208  阅读(155)  评论(0编辑  收藏  举报