随笔分类 - SQL
摘要:7.1 改变访问结构 7.2 修改SQL语句 SELECT deptno FROM dept WHERE deptno NOT IN (SELECT deptno FROM emp); SELECT deptno ...
阅读全文
摘要:group by 擴展 rollup&&cube --按job分組計算不同job的匯總工資 SELECT job, SUM (sal) FROM emp GROUP BY job ORDER BY job; --向rollup傳遞一列 SELECT job, SUM (sal) FROM emp GROUP BY ROLLUP (job) ...
阅读全文
摘要:--使用connect by和strart with子句 SELECT [level],column,expression, ... FROM table [WHERE where_clause] [[START WITH start_condition] [CONNECT BY prior_condition]]; SELECT empno, ...
阅读全文
摘要:explain plan explain plan for sql_statement select * from table(dbms_xplan.display) DBMS_XPLAN包 1.select * from table(dbms_xplan.dis...
阅读全文
摘要:在HelloDBA网站找到一个分析sql性能的工具—showplan,记录一下 showplan.sql下载路径:http://www.HelloDBA.com/Download/showplan.zip 使用方式就是调用该工具,传入SQL_ID作为参数。 SQL> @/dmp/showplan.sql 26xj87b2f8g6u Usage: @showplan [Plan Hash...
阅读全文
摘要:REGEXP_SUBSTR函数格式如下: function REGEXP_SUBSTR(String, pattern, position, occurrence, modifier) __srcstr :需要进行正则处理的字符串 __pattern :进行匹配的正则表达式 __position :起始位置,从第几个字符开始正则表达式...
阅读全文
摘要:inner-join left-outer-join right-outer-join full-outer-join cross-join 演示上面的情况,建立departments 和employees 表 CREA...
阅读全文
摘要:1,select * from salgrade for update session1 session2 SQL> delete salgrade where grade=1; 1 row deleted. ...
阅读全文
摘要:創建表 CREATE TABLE PROCESS_TIMING_LOG ( PROCESS_NAME VARCHAR2(50 BYTE), EXECUTION_DATE DATE, RECORDS_PROCESSED NUMBER, ELAPSED_TIME_SEC NUMBER ) 創建Procedure CREA...
阅读全文
摘要:1.B樹索引的結構 索引分支塊 包含指向索引分支塊/葉子塊的指針和索引鍵值列 (這裡指針指的是指向索引分支塊/葉子塊的塊地址RDBA。每個索引分支塊有兩種類型的指針,一種lmc(left most child),一種索引行記錄所記錄的指針。lmc那就是指向最左邊的那個分支塊/葉子塊) lmc指向的分支塊/葉子塊的最大值一定它下面最左邊的分支塊/葉子塊...
阅读全文
摘要:測試表emp RANK SQL> select EMPNO,DEPTNO,SAL, 2 rank()over(partition by DEPTNO order by SAL) "rank" 3 from emp; EMPNO DEPTNO SAL rank 7934 10 1300 1 7782
阅读全文
摘要:oracle merge 語法: 用途: Use the MERGE statement to select rows from one or more sources for update orinsertion into a table or view. You can specify cond
阅读全文
摘要:1 COALESCE 語法:COALESCE(expr1, expr2, ..., exprn) n>=2 作用:COALESCE returns the first non-null expr in the expression list. You must specify at leasttwo
阅读全文

浙公网安备 33010602011771号