Loading

01 2015 档案

摘要:删除表重复数据 (t1表中有重复数据)1、使用distinct create table t2 as select * from t1;create table tmp_t2 as select distinct * from t2;drop table t2;alter table tmp_t2 ... 阅读全文
posted @ 2015-01-28 14:10 uzipi 阅读(916) 评论(0) 推荐(0)
摘要:select case when to_char(last_day(add_months(trunc( sysdate ,'y'),1)),'dd') = '28' then '平年' else '闰年' end as isLeapYearfrom dual第一步:取日期... 阅读全文
posted @ 2015-01-06 11:30 uzipi 阅读(1898) 评论(1) 推荐(0)
摘要:(1)oracle使用keep分析函数取最值记录-- 取工资sal最大的雇员姓名及其工资,以及工资sal最少的雇员姓名及其工资select deptno, empno, ename, sal, max(ename) keep(dense_... 阅读全文
posted @ 2015-01-06 10:17 uzipi 阅读(44616) 评论(0) 推荐(1)
摘要:oracle分析函数——listagg篇(1)使用listagg将多行数据合并到一行例表:select deptno, ename from emp order by deptno, ename假设有一个需求,需要将emp表中相同部门的雇员姓名存放到一行中,不同的姓名用逗号“,”分隔,结果如下图:我... 阅读全文
posted @ 2015-01-06 09:17 uzipi 阅读(555) 评论(0) 推荐(0)
摘要:使用oracle提供的regexp_substr()函数,对将IPV4地址分成4段:select v.ip as ip_address, regexp_substr(v.ip,'[^.]+',1,1) as A, regexp_substr(v.ip,'[^.]... 阅读全文
posted @ 2015-01-05 15:44 uzipi 阅读(1495) 评论(0) 推荐(0)
摘要:The Q-quote delimiter can be any single- or multibyte character except space, tab, and return. If the opening quote delimiter is a[,{,, or)character. ... 阅读全文
posted @ 2015-01-05 14:51 uzipi 阅读(532) 评论(0) 推荐(0)
摘要:oracle中常用到ROWNUM,所以做一些本人对rownum的一些认识和使用技巧的记录,以便备查。一、rownum的说明 rownum是oracle特有的一个关键字。 (1)对于基表,在insert记录时,oracle就按照insert的顺序,将rownum分配给每一行记录,因此在select... 阅读全文
posted @ 2015-01-05 10:46 uzipi 阅读(8033) 评论(0) 推荐(1)