您的位置:首页 > 数据库 > Oracle

oracle积累继续

2013-09-03 16:49 155 查看
选出当天的日期的数据

select * from test_table where to_char(datetime, 'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd');

要想改变查询的结果,可以用 (case when then else end) as 句式

select (case when to_char(datetime, 'yyyy-mm-dd')=to_char(sysdate,'yyyy-mm-dd') then '今日' else '非今日' end) as datetime, shengfu from test_table;

repalce用法

replace(c1, c2, c3)

从c1字符串中找到c2字符,替换成c3字符

lpad用法

lpad(c1, length, c3)

返回没有length长,用c3再左边补齐

比length长,从右边截断

选两张表,结合

select t1.sname||'_VS_'||t2.sname from qiudui t1, qiudui t2 where t1.sname<>t2.sname;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: