没有合适的资源?快使用搜索试试~ 我知道了~
首页Oracle数据库11g SQL语言参考指南
"Oracle® Database SQL Language Reference 11g Release 2 (11.2) E41084-03"
Oracle数据库SQL语言参考是Oracle 11g Release 2的重要文档,旨在为用户提供关于SQL在Oracle数据库中的详细语法、用法和功能。这本书由Diana Lorentz和MaryBeth Roeser为主要作者,并有众多其他贡献者共同编写,覆盖了从基础到高级的SQL概念,适合数据库管理员(DBA)、开发人员和SQL查询用户参考。
1. **SQL简介**
- SQL(Structured Query Language)是用于管理和处理关系数据库的标准语言。
- 在Oracle 11g中,SQL支持数据查询、插入、更新、删除,以及复杂的数据库操作,如创建表、视图、索引等。
2. **数据查询**
- `SELECT`语句:用于从一个或多个表中检索数据,支持各种选择条件、聚合函数(如COUNT、SUM、AVG、MAX、MIN)和排序(ORDER BY)。
- `JOIN`操作:用于合并不同表的数据,包括内连接(INNER JOIN)、外连接(LEFT JOIN、RIGHT JOIN、FULL JOIN)。
- 子查询:嵌套在其他SQL语句中的查询,可以作为表达式的一部分,用于比较、过滤或计算。
3. **数据插入和更新**
- `INSERT`语句:向表中插入新的行。
- `UPDATE`语句:修改现有表中行的数据。
- `DELETE`语句:从表中删除指定的行。
4. **表和索引的创建与管理**
- `CREATE TABLE`:定义新的数据库表结构。
- `ALTER TABLE`:修改已存在的表结构,如添加、删除或修改列。
- `DROP TABLE`:删除不再需要的表。
- `CREATE INDEX`:提高查询性能,通过创建索引来加速对特定列的查找。
5. **视图**
- 视图是虚拟表,基于一个或多个表的SELECT查询结果。它们可以简化复杂查询,提供安全性,或仅显示所需的数据列。
6. **存储过程和函数**
- 存储过程是一组预编译的SQL语句,可封装成一个单元,便于重复调用和执行复杂的业务逻辑。
- 自定义函数允许创建返回值的自定义操作。
7. **事务和并发控制**
- 事务是SQL中的逻辑工作单元,包含一组操作,要么全部成功,要么全部回滚。
- Oracle 11g提供了锁定机制和多版本并发控制(MVCC),以处理并发操作。
8. **触发器和约束**
- 触发器在满足特定条件时自动执行,常用于实施业务规则或审计。
- 约束确保数据完整性,如NOT NULL、UNIQUE、FOREIGN KEY等。
9. **PL/SQL编程**
- PL/SQL是Oracle的编程语言,结合了SQL和过程编程,用于编写存储过程、函数、包和其他数据库对象。
10. **性能优化**
- 分析工具,如EXPLAIN PLAN,用于理解查询执行计划,找出性能瓶颈。
- 使用绑定变量、物化视图、分区和索引策略来优化查询性能。
Oracle Database SQL Language Reference 11g Release 2提供了全面的SQL语法参考,涵盖了数据库管理、数据操作、程序设计和性能优化等多个方面,是Oracle数据库用户不可或缺的参考资料。
xvi
Hierarchical Query Examples .......................................................................................................... 9-5
The UNION [ALL], INTERSECT, MINUS Operators ...................................................................... 9-8
Sorting Query Results ......................................................................................................................... 9-10
Joins ......................................................................................................................................................... 9-11
Join Conditions ............................................................................................................................... 9-11
Equijoins .......................................................................................................................................... 9-11
Self Joins .......................................................................................................................................... 9-12
Cartesian Products ......................................................................................................................... 9-12
Inner Joins ....................................................................................................................................... 9-12
Outer Joins ....................................................................................................................................... 9-12
Antijoins .......................................................................................................................................... 9-14
Semijoins .......................................................................................................................................... 9-14
Using Subqueries ................................................................................................................................. 9-14
Unnesting of Nested Subqueries ...................................................................................................... 9-15
Selecting from the DUAL Table ........................................................................................................ 9-16
Distributed Queries ............................................................................................................................. 9-16
10 SQL Statements: ALTER CLUSTER to ALTER JAVA
Types of SQL Statements .................................................................................................................... 10-1
Data Definition Language (DDL) Statements ............................................................................ 10-2
Data Manipulation Language (DML) Statements ..................................................................... 10-2
Transaction Control Statements ................................................................................................... 10-3
Session Control Statements ........................................................................................................... 10-3
System Control Statement ............................................................................................................. 10-3
Embedded SQL Statements .......................................................................................................... 10-3
How the SQL Statement Chapters are Organized ......................................................................... 10-4
ALTER CLUSTER ................................................................................................................................ 10-5
ALTER DATABASE ............................................................................................................................ 10-9
ALTER DATABASE LINK ............................................................................................................... 10-47
ALTER DIMENSION ........................................................................................................................ 10-49
ALTER DISKGROUP ........................................................................................................................ 10-52
ALTER FLASHBACK ARCHIVE .................................................................................................... 10-75
ALTER FUNCTION ........................................................................................................................... 10-78
ALTER INDEX .................................................................................................................................... 10-79
ALTER INDEXTYPE .......................................................................................................................... 10-98
ALTER JAVA .................................................................................................................................... 10-101
11 SQL Statements: ALTER LIBRARY to ALTER SYSTEM
ALTER LIBRARY .................................................................................................................................. 11-2
ALTER MATERIALIZED VIEW ....................................................................................................... 11-3
ALTER MATERIALIZED VIEW LOG ........................................................................................... 11-18
ALTER OPERATOR .......................................................................................................................... 11-25
ALTER OUTLINE .............................................................................................................................. 11-28
ALTER PACKAGE ............................................................................................................................. 11-30
ALTER PROCEDURE ........................................................................................................................ 11-31
ALTER PROFILE ................................................................................................................................ 11-32
ALTER RESOURCE COST ............................................................................................................... 11-35
xvii
ALTER ROLE ...................................................................................................................................... 11-38
ALTER ROLLBACK SEGMENT ..................................................................................................... 11-40
ALTER SEQUENCE ........................................................................................................................... 11-43
ALTER SESSION ............................................................................................................................... 11-45
Initialization Parameters and ALTER SESSION....................................................................... 11-50
Session Parameters and ALTER SESSION ............................................................................... 11-51
ALTER SYSTEM ................................................................................................................................. 11-58
12 SQL Statements: ALTER TABLE to ALTER TABLESPACE
ALTER TABLE ...................................................................................................................................... 12-2
ALTER TABLESPACE ....................................................................................................................... 12-90
13 SQL Statements: ALTER TRIGGER to COMMIT
ALTER TRIGGER ................................................................................................................................ 13-2
ALTER TYPE ......................................................................................................................................... 13-4
ALTER USER ........................................................................................................................................ 13-5
ALTER VIEW ...................................................................................................................................... 13-12
ANALYZE ............................................................................................................................................ 13-15
ASSOCIATE STATISTICS .............................................................................................................. 13-23
AUDIT .................................................................................................................................................. 13-27
CALL ..................................................................................................................................................... 13-40
COMMENT ......................................................................................................................................... 13-44
COMMIT ............................................................................................................................................. 13-47
14 SQL Statements: CREATE CLUSTER to CREATE JAVA
CREATE CLUSTER .............................................................................................................................. 14-2
CREATE CONTEXT ............................................................................................................................ 14-9
CREATE CONTROLFILE ................................................................................................................. 14-12
CREATE DATABASE ........................................................................................................................ 14-19
CREATE DATABASE LINK ............................................................................................................ 14-31
CREATE DIMENSION ..................................................................................................................... 14-36
CREATE DIRECTORY ...................................................................................................................... 14-41
CREATE DISKGROUP ..................................................................................................................... 14-43
CREATE EDITION ............................................................................................................................ 14-51
CREATE FLASHBACK ARCHIVE ................................................................................................. 14-55
CREATE FUNCTION ........................................................................................................................ 14-58
CREATE INDEX ................................................................................................................................. 14-60
CREATE INDEXTYPE ....................................................................................................................... 14-87
CREATE JAVA .................................................................................................................................... 14-91
15 SQL Statements: CREATE LIBRARY to CREATE SPFILE
CREATE LIBRARY .............................................................................................................................. 15-2
CREATE MATERIALIZED VIEW .................................................................................................... 15-4
CREATE MATERIALIZED VIEW LOG ........................................................................................ 15-27
CREATE OPERATOR ....................................................................................................................... 15-35
xviii
CREATE OUTLINE ............................................................................................................................ 15-38
CREATE PACKAGE .......................................................................................................................... 15-42
CREATE PACKAGE BODY ............................................................................................................. 15-44
CREATE PFILE ................................................................................................................................... 15-46
CREATE PROCEDURE ..................................................................................................................... 15-48
CREATE PROFILE ............................................................................................................................. 15-50
CREATE RESTORE POINT ............................................................................................................. 15-56
CREATE ROLE ................................................................................................................................... 15-59
CREATE ROLLBACK SEGMENT .................................................................................................. 15-62
CREATE SCHEMA ............................................................................................................................ 15-65
CREATE SEQUENCE ........................................................................................................................ 15-67
CREATE SPFILE ................................................................................................................................. 15-71
16 SQL Statements: CREATE SYNONYM to CREATE TRIGGER
CREATE SYNONYM ........................................................................................................................... 16-2
CREATE TABLE ................................................................................................................................... 16-6
CREATE TABLESPACE .................................................................................................................... 16-83
CREATE TRIGGER ........................................................................................................................... 16-98
17 SQL Statements: CREATE TYPE to DROP ROLLBACK SEGMENT
CREATE TYPE ...................................................................................................................................... 17-3
CREATE TYPE BODY ......................................................................................................................... 17-5
CREATE USER ...................................................................................................................................... 17-7
CREATE VIEW ................................................................................................................................... 17-14
DELETE ................................................................................................................................................ 17-26
DISASSOCIATE STATISTICS ....................................................................................................... 17-34
DROP CLUSTER ................................................................................................................................ 17-36
DROP CONTEXT ............................................................................................................................... 17-38
DROP DATABASE ............................................................................................................................ 17-39
DROP DATABASE LINK ................................................................................................................. 17-40
DROP DIMENSION .......................................................................................................................... 17-41
DROP DIRECTORY .......................................................................................................................... 17-42
DROP DISKGROUP ......................................................................................................................... 17-43
DROP EDITION ................................................................................................................................. 17-45
DROP FLASHBACK ARCHIVE ..................................................................................................... 17-47
DROP FUNCTION ............................................................................................................................ 17-48
DROP INDEX....................................................................................................................................... 17-50
DROP INDEXTYPE ........................................................................................................................... 17-52
DROP JAVA ........................................................................................................................................ 17-53
DROP LIBRARY ................................................................................................................................. 17-54
DROP MATERIALIZED VIEW........................................................................................................ 17-55
DROP MATERIALIZED VIEW LOG ............................................................................................ 17-57
DROP OPERATOR ............................................................................................................................ 17-59
DROP OUTLINE ................................................................................................................................ 17-60
DROP PACKAGE .............................................................................................................................. 17-62
DROP PROCEDURE ......................................................................................................................... 17-64
DROP PROFILE .................................................................................................................................. 17-65
xix
DROP RESTORE POINT ................................................................................................................. 17-66
DROP ROLE ........................................................................................................................................ 17-67
DROP ROLLBACK SEGMENT ...................................................................................................... 17-68
18 SQL Statements: DROP SEQUENCE to ROLLBACK
DROP SEQUENCE .............................................................................................................................. 18-2
DROP SYNONYM ............................................................................................................................... 18-3
DROP TABLE ........................................................................................................................................ 18-5
DROP TABLESPACE .......................................................................................................................... 18-9
DROP TRIGGER................................................................................................................................. 18-12
DROP TYPE ......................................................................................................................................... 18-13
DROP TYPE BODY ............................................................................................................................ 18-15
DROP USER ........................................................................................................................................ 18-16
DROP VIEW ........................................................................................................................................ 18-18
EXPLAIN PLAN .................................................................................................................................. 18-20
FLASHBACK DATABASE................................................................................................................ 18-24
FLASHBACK TABLE ........................................................................................................................ 18-27
GRANT ................................................................................................................................................. 18-33
INSERT ................................................................................................................................................. 18-54
LOCK TABLE ...................................................................................................................................... 18-71
MERGE ................................................................................................................................................. 18-74
NOAUDIT ............................................................................................................................................ 18-79
PURGE .................................................................................................................................................. 18-83
RENAME .............................................................................................................................................. 18-85
REVOKE ............................................................................................................................................... 18-87
ROLLBACK ......................................................................................................................................... 18-96
19 SQL Statements: SAVEPOINT to UPDATE
SAVEPOINT ......................................................................................................................................... 19-2
SELECT ................................................................................................................................................... 19-4
SET CONSTRAINT[S] ...................................................................................................................... 19-59
SET ROLE ............................................................................................................................................ 19-61
SET TRANSACTION ........................................................................................................................ 19-64
TRUNCATE CLUSTER ..................................................................................................................... 19-67
TRUNCATE TABLE .......................................................................................................................... 19-69
UPDATE ............................................................................................................................................... 19-73
A How to Read Syntax Diagrams
Graphic Syntax Diagrams...................................................................................................................... A-1
Required Keywords and Parameters ............................................................................................ A-2
Optional Keywords and Parameters ............................................................................................. A-3
Syntax Loops...................................................................................................................................... A-3
Multipart Diagrams ......................................................................................................................... A-4
Database Objects .............................................................................................................................. A-4
xx
B Automatic and Manual Locking Mechanisms During SQL Operations
Automatic Locks in DML Operations ................................................................................................. B-1
Automatic Locks in DDL Operations.................................................................................................. B-4
Exclusive DDL Locks........................................................................................................................ B-4
Share DDL Locks............................................................................................................................... B-4
Breakable Parse Locks ...................................................................................................................... B-5
Manual Data Locking ............................................................................................................................. B-5
C Oracle and Standard SQL
ANSI Standards ...................................................................................................................................... C-1
ISO Standards .......................................................................................................................................... C-2
Oracle Compliance To Core SQL:2008 ................................................................................................ C-3
Oracle Support for Optional Features of SQL/Foundation:2008.................................................... C-9
Oracle Compliance with SQL/CLI:2008 ............................................................................................ C-20
Oracle Compliance with SQL/PSM:2008 .......................................................................................... C-20
Oracle Compliance with SQL/MED:2008 ......................................................................................... C-20
Oracle Compliance with SQL/OLB:2008........................................................................................... C-21
Oracle Compliance with SQL/JRT:2008............................................................................................ C-21
Oracle Compliance with SQL/XML:2008.......................................................................................... C-21
Oracle Compliance with FIPS 127-2 ................................................................................................. C-25
Oracle Extensions to Standard SQL .................................................................................................. C-26
Oracle Compliance with Older Standards ....................................................................................... C-27
Character Set Support........................................................................................................................... C-27
D Oracle Regular Expression Support
Multilingual Regular Expression Syntax .......................................................................................... D-1
Regular Expression Operator Multilingual Enhancements............................................................ D-2
Perl-influenced Extensions in Oracle Regular Expressions ........................................................... D-3
E Oracle SQL Reserved Words and Keywords
Oracle SQL Reserved Words................................................................................................................. E-1
Oracle SQL Keywords............................................................................................................................ E-3
F Extended Examples
Using Extensible Indexing ................................................................................................................... F-1
Using XML in SQL Statements ............................................................................................................ F-8
Index
剩余1629页未读,继续阅读
2010-09-02 上传
2015-03-22 上传
2011-12-06 上传
2011-03-14 上传
点击了解资源详情
2023-06-18 上传
2019-08-12 上传
2021-12-14 上传
2023-06-17 上传
haopu
- 粉丝: 0
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- C语言数组操作:高度检查器编程实践
- 基于Swift开发的嘉定单车LBS iOS应用项目解析
- 钗头凤声乐表演的二度创作分析报告
- 分布式数据库特训营全套教程资料
- JavaScript开发者Robert Bindar的博客平台
- MATLAB投影寻踪代码教程及文件解压缩指南
- HTML5拖放实现的RPSLS游戏教程
- HT://Dig引擎接口,Ampoliros开源模块应用
- 全面探测服务器性能与PHP环境的iprober PHP探针v0.024
- 新版提醒应用v2:基于MongoDB的数据存储
- 《我的世界》东方大陆1.12.2材质包深度体验
- Hypercore Promisifier: JavaScript中的回调转换为Promise包装器
- 探索开源项目Artifice:Slyme脚本与技巧游戏
- Matlab机器人学习代码解析与笔记分享
- 查尔默斯大学计算物理作业HP2解析
- GitHub问题管理新工具:GIRA-crx插件介绍
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功