
ORACLE 学习笔记
文章平均质量分 65
shpd2852856
这个作者很懒,什么都没留下…
展开
-
Oracle -- Extended Group By Clause
Oracle -- Extended Group By Clause ROLLUP(), CUBE(), GROUPING_SETS(), GROUPING(), GRUOPING_ID(), GROUP_ID() 1. ROLLUP() --返回n+1层小计 a) select division_id, job_id, sum(salary) from EMPLOYEE原创 2012-03-24 12:48:00 · 386 阅读 · 0 评论 -
Oracle基础学习笔记(五) (PL/SQL)
IF condition THEN ELSIF condition THEN ELSE END IF; LOOP ... CONTINUE; CONTINUE WHEN ... EXIT; EXIT WHEN ... END LOOP WHILE condition LOOP END LOOP; FOR var IN [R原创 2012-03-30 21:26:46 · 290 阅读 · 0 评论 -
ORACLE调优
1) ORACLE 的解析器按照从右到左的顺序处理FROM子句中的表名,因此FROM子句中写在最后的表(基础表 driving table)将被最先处理. 在FROM子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表.当ORACLE处理多个表时, 会运用排序及合并的方式连接它们.首先,扫描第一个表(FROM子句中最后的那个表)并对记录进行排序,然后扫描第二个表(FROM子句中最后第转载 2012-04-24 20:48:08 · 299 阅读 · 0 评论 -
ORACLE学习笔记 (六) (SQL*PLUS)
SQL>conn SYS/Abcd1234#@orcl as SYSDBA SQL>show user; SQL>@ D:\collection_schema.sql SQL>VARIABLE (查询Bind Variable) SQL>PRINT var_name (查询指定bind variable 中的值) SQL>DEFINE SQL>SET DEFINE '#' SQL>S原创 2012-04-23 20:32:37 · 234 阅读 · 0 评论 -
ORACLE Varaible
1) Bind Variable (is session specific and need to be reset if the session is lost) (note : use F5 to run script, F9 run statement won't work) VARIABLE v_id NUMBER BEGIN :v_id := 1; (need to e原创 2012-04-26 07:10:32 · 374 阅读 · 0 评论 -
Oracle DBA
1) 用SQLPLUS连接数据库 SQLPLUS SYS/Abcd1234#@orcl AS SYSDBA CONNECT store/store_password 2) 创建用户 CREATE USER store IDENTIFIED BY store_password; ALTER USER store IDENTIFIED BY store_pwd; 3)赋予用户权限原创 2012-04-19 07:28:50 · 251 阅读 · 0 评论 -
Oracle基础学习笔记(二)(Index)
Oracle automatically create a B-tree Index for Primary key or the column which has UNIQUE constraint. CREATE [UNIQUE] INDEX index_name ON tab_name(col_name[, col_name ...]) TABLESPACE tab_space;原创 2012-03-30 07:37:38 · 315 阅读 · 0 评论 -
Oracle基础学习笔记(四)(VIEW)
CREATE [OR REPLACE] VIEW [{FORCE | NOFORCE}] view_name AS subquery [WITH {CHECK OPTION | READ ONLY} CONSTRAINT cons_name]; FORCE -- the view can be created even the base tables doesn't exist. W原创 2012-03-30 21:18:12 · 241 阅读 · 0 评论 -
Oracle基础学习笔记(三)(Import, Export, SQL Loader)
EXPORT, IMPORT are used for following tasks : Backup Oracle data in operating system files. Restore tables that were dropped Save space or reduce fragmentation in the database Move data from one o原创 2012-03-30 13:47:16 · 520 阅读 · 0 评论 -
Oracle基础学习笔记(一)(Create Table, ALTER, RENAME, SEQUENCE)
1) CREATE [GLOBAL TEMPORARY] TABLE name ( ) [ON COMMIT {DELETE|PRESERVE} ROWS] TABLESPACE name; ON COMMIT -- to set the duration of the rows persist in the temporary table DELETE(by defaul原创 2012-03-29 18:23:05 · 1673 阅读 · 0 评论 -
Best Practice in SQL
1) Avoid searching based on concatenation Select * from employee where empno || name = ’1234qiao’ Select * from employee where empno=1234 and name = ’qiao’ 2) It is advisable to put t原创 2012-03-28 14:26:00 · 333 阅读 · 0 评论 -
Best practice in PL/SQL
1) Some declarations may be costly process Defer the declarations till it is required Search of unwanted variables and remove them 2) Prefer Built-in functions over the user defined.原创 2012-03-28 14:28:04 · 335 阅读 · 0 评论