oracle高级sql指南

Oracle SQL 高级开发指南

     正在编写oracle高级sql开发指南,包含开发中常用的oracle sql技术,以及复杂的sql分析技术,性能调整等问题。并且收录一些比较优秀的sql。下面是暂定目录:

Advanced sql in oracle

1.集合操作... 2

1.1.unionunion all 2

1.2.intersect交集操作... 3

1.3. minus差集操作... 3

2.existsnot exists的使用... 4

2.1. exists的使用... 4

2.2 not exists的使用... 5

3.with子句... 6

4.merge into合并资料... 8

5.层次查询(Hierarical Retrival) 11

6.decode函数和行列互换... 22

7.case表达式... 30

7.1 case简介... 30

7.2 两种case. 31

7.3 综合实例... 32

8.rownum—top-N分析... 34

9.相关子查询和非相关子查询... 37

10.增强的group by. 38

11.分析函数... 39

12. oracle10g正则表达式... 39

13.使用hint 39

14.Parition分区... 39

15.并行操作... 39

16.扩展DDLDML语句... 40

16.1 背景和目标... 40

16.2 经常使用的扩展... 40

16.3向多个目标insert 41

16.4 external tables(外部表) 45

17.Model语句... 46

18.专题行列转换... 46

 

1.集合操作

学习oracle中集合操作的有关语句,掌握union,union all,minus,interest的使用,能够描述结合运算,并且能够将多个查询组合到一个查询中去,能够控制行返回的顺序。

包含集合运算的查询称为复合查询。见表格1-1

1-1

Operator

Returns

content

UNION

由每个查询选择的所有不同的行

 并集不包含重复值

UNION ALL

由每个查询选择的所有的行,包括所有重复的行

完全并集包含重复值

INTERSECT

由两个查询选择的所有不同的行

 交集

MINUS

由第一个查询选择的所有不同的行

 差集

 

所有的集合运算与等号的优先级相同,如果SQL语句包含多个集合运算并且没有圆括号明确地指定另一个顺序,Oracle服务器将以从左到右的顺序计算。你应该使用圆括号来明确地指定带另外的集合运算的INTERSECT (相交) 运算查询中的赋值顺序。

Union all 效率一般比union高。

1.1.unionunion all

UNION(联合)运算

UNION运算返回所有由任一查询选择的行。用UNION运算从多表返回所有行,但除去任何重复的行。

原则 :

 

Contents iii 3 Enhancements to the GROUP BY Clause Objectives 3-2 Review of Group Functions 3-3 Review of the GROUP BY Clause 3-4 Review of the HAVING Clause 3-5 GROUP BY with ROLLUP and CUBE Operators 3-6 ROLLUP Operator 3-7 ROLLUP Operator Example 3-8 CUBE Operator 3-9 CUBE Operator: Example 3-10 GROUPING Function 3-11 GROUPING Function: Example 3-12 GROUPING SETS 3-13 GROUPING SETS: Example 3-15 Composite Columns 3-17 Composite Columns: Example 3-19 Concatenated Groupings 3-21 Concatenated Groupings Example 3-22 Summary 3-23 Practice 3 Overview 3-24 4 Advanced Subqueries Objectives 4-2 What Is a Subquery? 4-3 Subqueries 4-4 Using a Subquery 4-5 Multiple-Column Subqueries 4-6 Column Comparisons 4-7 Pairwise Comparison Subquery 4-8 Nonpairwise Comparison Subquery 4-9 Using a Subquery in the FROM Clause 4-10 Scalar Subquery Expressions 4-11 Scalar Subqueries: Examples 4-12 Correlated Subqueries 4-14 Using Correlated Subqueries 4-16 Using the EXISTS Operator 4-18 Using the NOT EXISTS Operator 4-20 Correlated UPDATE 4-21 The WITH Clause 4-26 WITH Clause: Example 4-27 Summary 4-29 Practice 4 Overview 4-31 iv 5 Hierarchical Retrieval Objectives 5-2 Sample Data from the EMPLOYEES Table 5-3 Natural Tree Structure 5-4 Hierarchical Queries 5-5 Walking the Tree 5-6 Walking the Tree: From the Bottom Up 5-8 Walking the Tree: From the Top Down 5-9 Ranking Rows with the LEVEL Pseudocolumn 5-10 Formatting Hierarchical Reports Using LEVEL and LPAD 5-11 Pruning Branches 5-13 Summary 5-14 Practice 5 Overview 5-15 6 Oracle9i Extensions to DML and DDL Statements Objectives 6-2 Review of the INSERT Statement 6-3 Review of the UPDATE Statement 6-4 Overview of Multitable INSERT Statements 6-5 Types of Multitable INSERT Statements 6-7 Multitable INSERT Statements 6-8 Unconditional INSERT ALL 6-10 Conditional INSERT ALL 6-11 Conditional FIRST INSERT 6-13 Pivoting INSERT 6-15 External Tables 6-18 Creating an External Table 6-19 Example of Creating an External Table 6-20 Querying External Tables 6-23 CREATE INDEX with CREATE TABLE Statement 6-24 Summary 6-25 Practice 6 Overview 6-26 A Practice Solutions B Table Descriptions and Data C Writing Advanced Scripts D Oracle Architectural Components Index Additional Practices Additional Practice Solutions Additional Practices: Table Descriptions and Data
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值