oralce 分析函数 over partition by,开窗函数
over(Partition by...) 一个超级牛皮的ORACLE特有函数。天天都用ORACLE,用了快2年了。最近才接触到这个功能强大而灵活的函数。真实惭愧啊!oracle的分析函数over 及开窗函数一:分析函数overOracle从8.1.6开始提供分析函数,分析函数用于计算基于组的某种聚合值,它和聚合函数的不同之处是对于每个组返回多行,...
Flashback查询
decode & case
层次查询start with connect by
with语句重用子查询
显示部门工资总额超过所有部门平均工资总额的部门名,工资总额
左右外连接,union 去重union all 不去重
select empno,ename,dname from emp e , dept dwhere e.deptno=d.deptno(+) --加号生成null,补齐所在的表以显示无加号表的全部数据union --- 去重select empno,ename,dname from emp e , dept dwhere e.deptno(+)=d.deptno;
merge
merge into new n using emp eon(n.empno=e.empno)when matched then update set n.sal=e.salwhen not matched theninsert (n.empno,n.ename,n.sal,n.comm)values(e.empno,e.ename,e.sal,e.comm);
update
update emp set sal=2460 where lower(ename)='scott';select * from emp;update emp set sal=sal*1.1, comm=sal*0.1where deptno=20;select * from emp where empno=7788;select job from emp where ename='SCOTT';update emp set job=default where ename='SCOTT'; --如果不存在默认值,会输出nul...
Oracle出现ORA-01775: 同义词的循环链问题
create public synonym employee for hr.employee;select * from employee;ORA-01775: looping chain of synonyms01775. 00000 - "looping chain of synonyms"*Cause: *Action:Error at Line: 30 Column: 15一般是因为存在同义词,但同义词没有相应的对象。HR里的那...
insert all , insert first 使用多表插入
insert allinto SAL_HISTORY values (ename,hiredate,sal)into MGR_HISTORY values (ename,mgr,sal)select ename,hiredate,mgr,sal from emp;insert allwhen sal>1000 theninto SAL_HISTORY values (ename, hiredate,sal)when mgr>7700 theninto MGR_HISTORY values (ename,mgr,sal)select ename,hiredate,mg...
三范式
为了建立冗余较小、结构合理的数据库,设计数据库时必须遵循一定的规则。在关系型数据库中这种规则就称为范式。范式是符合某一种设计要求的总结。要想设计一个结构合理的关系型数据库,必须满足一定的范式。在实际开发中通常满足第三范式即可: ...
/*+APPEND*/插入性能总结
使用append提示进行insert叫做直接路径加载插入。【特点】1、使用这种提示因为系统不去查找freelist链表中的空闲块,直接在高水标记位以上插入数据,因此速度比较快。但若是对于经常delete的表,浪费磁盘空...
Oracle正则表达式的应用 regexp_like,regexp_substr,regexp_instr......
Oracle正则表达式的应用在oracle里正则表达式有四个函数可用,分别是regexp_like、regexp_substr、regexp_instr 和regexp_replace。这里在我们oracle 10g里灵活应用。 先来简单介绍一下正则表达式的内容,正则表达式是做为快速查询的文本内容的,在linux应用比较多,首先,...
ESCAPE _
SELECT EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO FROM EMP WHERE ENAME LIKE '%A_%' ESCAPE 'A';
win8 日文输入法
控制面板-时钟、语言和区域-语言-添加语言。。下拉找到日本语。。点添加,就ok了
更改SQLDeveloper的界面语言
After you download Oracle SQL developer 2.1,you will find it's all in chinese if you located in China.there is one way to change it into english 1.find sqldeveloper.conf in location ../sqldeveloper/bin/sqldeveloper.conf 2.open it,and add below 2 item &nb...
oracle 11g用户的解锁与加锁(hr模式)
SQL> conn sys/sys as sysdba Connected.SQL> show userUSER is "SYS"SQL> alter user hr account unlock;(解锁)User altered.SQL> alter user hr identified by *password*;(更改密码,这一步是必需的,否则hr模式还是不能使用的)User altered.到这里hr...
大米的oracle
150103 Pro Oracle SQLRDBMS=relational database management systemsANSI=American National Standards Institute Oracle Call Interface (OCI). Oracle调用界面The bottomline is that the tool you use doesn’t matter; the native interface is the same for all.here are actually two files th...
大米的informatica
用agg组建& tgt pre load 过滤src 重复数据src 6 个字段, 有重复数据。group the src rows by first 5 columns using agggive 'null' to the 6th column with an expression.in tgt pre load: delete * from tgt where 6th column is nullStartYear StartMonth &...