2016年9月23日
摘要: 1. Oracle跟SQL Server 2005的区别? 宏观上: 1). 最大的区别在于平台,oracle可以运行在不同的平台上,sql server只能运行在windows平台上,由于windows平台的稳定性和安全性影响了sql server的稳定性和安全性 2). oracle使用的脚本语 阅读全文
posted @ 2016-09-23 16:56 风吹羽 阅读(131) 评论(0) 推荐(0) 编辑
摘要: select extract(month from hiredate) 入职月份,count(*) 人数 from empwhere extract(year from hiredate)='1981' group by extract(month from hiredate) order by 入 阅读全文
posted @ 2016-09-23 15:49 风吹羽 阅读(1291) 评论(0) 推荐(0) 编辑
摘要: select * from emp where extract(year from hiredate)=1981 and extract(month from hiredate)>6; 结果: 阅读全文
posted @ 2016-09-23 15:40 风吹羽 阅读(424) 评论(0) 推荐(0) 编辑
摘要: select * from emp where to_char(hiredate,'mm')=to_char(add_months( sysdate,2),'mm'); 结果: 阅读全文
posted @ 2016-09-23 15:23 风吹羽 阅读(174) 评论(0) 推荐(0) 编辑
摘要: testtable1 testtable2 select t2.id,t2.dptid,nvl(t1.department,'黑人'),t2.name from testtable2 t2 left join testtable1 t1 on t2.dptid=t1.id; 结果: 阅读全文
posted @ 2016-09-23 13:44 风吹羽 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 输出 方法1:select sno,cno,score,case when score>=60 then 'pass' else 'fail' end 结果 from sc; 方法2:select sno,cno,score,decode (sign(score-60),-1,'fail','pas 阅读全文
posted @ 2016-09-23 13:28 风吹羽 阅读(173) 评论(0) 推荐(0) 编辑
摘要: select *from timp a, timp b where a.name > b.name 结果: 阅读全文
posted @ 2016-09-23 11:57 风吹羽 阅读(11659) 评论(0) 推荐(0) 编辑
摘要: select sno,nvl(to_char(sum(decode(cno,'c001',score))),'-') c001,nvl(to_char(sum(decode(cno,'c002',score))),'-') c002,nvl(to_char(sum(decode(cno,'c003' 阅读全文
posted @ 2016-09-23 11:25 风吹羽 阅读(236) 评论(0) 推荐(0) 编辑
摘要: select rq 日期,sum(decode(shengfu,'胜',1,'负',0)) 胜,sum(decode(shengfu,'负',1,'胜',0)) 负 from tmp group by rq; 结果: 阅读全文
posted @ 2016-09-23 10:41 风吹羽 阅读(170) 评论(0) 推荐(0) 编辑
摘要: select nvl(sno,'合计') sno,sum(score) score from sc group by rollup(sno); 阅读全文
posted @ 2016-09-23 10:13 风吹羽 阅读(7765) 评论(0) 推荐(0) 编辑
摘要: select to_char(日期,'yyyy-mm-dd') from( select to_date('2016-01-01','yyyy-mm-dd') + level 日期 from dual connect by level <=to_date('2016-12-31','yyyy-mm- 阅读全文
posted @ 2016-09-23 09:40 风吹羽 阅读(1987) 评论(0) 推荐(0) 编辑