没有合适的资源?快使用搜索试试~ 我知道了~
首页Oracle® Database SQL 语言参考指南
"Oracle® Database SQL Language Reference 11g Release 2 (11.2) E26088-01"
Oracle数据库SQL语言参考是Oracle公司发布的一本技术文档,专注于介绍Oracle数据库系统中SQL(结构化查询语言)的使用。这本书是11g Release 2版本,适用于开发人员、DBA以及对Oracle数据库有深入需求的用户。文档的编写者和贡献者众多,集合了多位专家的经验和知识。
在Oracle数据库中,SQL语言是与数据进行交互的主要工具,它允许用户创建、修改和查询数据库对象,如表、视图、索引等。以下是一些关键的SQL知识点:
1. **数据定义语言(DDL)**:包括CREATE、ALTER和DROP语句,用于创建新的数据库对象,修改现有对象,或删除不再需要的对象。例如,CREATE TABLE用于定义新表的结构,ALTER TABLE可以添加、删除或修改列,DROP TABLE则用于删除表。
2. **数据操纵语言(DML)**:涉及INSERT、UPDATE和DELETE操作,用于向表中插入新记录、更新现有记录或删除记录。
3. **查询语言**:使用SELECT语句从一个或多个表中检索数据。这涉及到选择(SELECT)、连接(JOIN)、分组(GROUP BY)、聚合(AGGREGATE functions,如COUNT、SUM、AVG等)、排序(ORDER BY)和子查询等概念。
4. **事务处理**:SQL支持BEGIN、COMMIT、ROLLBACK等语句,用于管理数据库中的事务,确保数据的一致性和完整性。
5. **视图(View)**:视图是虚拟表,由SELECT语句定义,可以提供简化或安全的接口到数据库数据。
6. **索引(Index)**:用于加速查询,通过CREATE INDEX语句创建,可以显著提升数据检索速度。
7. **约束(Constraints)**:用于定义列的规则,如NOT NULL(不允许为空)、UNIQUE(唯一性)、PRIMARY KEY(主键)和FOREIGN KEY(外键)等。
8. **游标(Cursor)**:在PL/SQL中,游标允许逐行处理查询结果,对于迭代处理大量数据非常有用。
9. **存储过程和函数**:用户可以定义自己的存储过程和函数,这些是预编译的SQL语句集合,可以提高性能并封装复杂的业务逻辑。
10. **触发器(Triggers)**:在特定事件(如INSERT、UPDATE或DELETE)发生时自动执行的代码段,用于实现业务规则或数据验证。
11. **分区(Partitioning)**:大型表可以被分割成更小、更易管理的部分,以提高查询性能和维护效率。
12. **物化视图(Materialized Views)**:预先计算并存储的结果集,提供快速的数据汇总和报告。
13. **并发控制**:Oracle提供了锁定机制来处理多用户同时访问数据库的情况,确保数据一致性。
14. **安全性**:通过GRANT和REVOKE语句管理用户的访问权限,控制谁可以访问哪些数据。
Oracle SQL Language Reference文档详尽地涵盖了以上所有内容,并且包含了大量的示例和解释,是学习和使用Oracle SQL的宝贵资源。对于数据库管理员和开发者来说,理解和掌握这些知识点是至关重要的,能够帮助他们高效地管理和操作Oracle数据库。
xvi
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
ALTER ROLE ....................................................................................................................................... 11-38
ALTER ROLLBACK SEGMENT ..................................................................................................... 11-40
xvii
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-32
CREATE DIMENSION ..................................................................................................................... 14-37
CREATE DIRECTORY ...................................................................................................................... 14-42
CREATE DISKGROUP ..................................................................................................................... 14-44
CREATE EDITION ............................................................................................................................. 14-52
CREATE FLASHBACK ARCHIVE ................................................................................................. 14-56
CREATE FUNCTION ........................................................................................................................ 14-59
CREATE INDEX ................................................................................................................................. 14-61
CREATE INDEXTYPE ....................................................................................................................... 14-88
CREATE JAVA ..................................................................................................................................... 14-92
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
CREATE OUTLINE ............................................................................................................................ 15-38
CREATE PACKAGE ........................................................................................................................... 15-42
xviii
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-82
CREATE TRIGGER ............................................................................................................................ 16-97
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
D R O P J AVA ......................................................................................................................................... 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
DROP RESTORE POINT ................................................................................................................. 17-66
DROP ROLE ........................................................................................................................................
17-67
xix
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-72
MERGE ................................................................................................................................................. 18-75
NOAUDIT ............................................................................................................................................ 18-80
PURGE .................................................................................................................................................. 18-84
RENAME .............................................................................................................................................. 18-86
REVOKE ............................................................................................................................................... 18-88
ROLLBACK ......................................................................................................................................... 18-97
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
B Automatic and Manual Locking Mechanisms During SQL Operations
Automatic Locks in DML Operations ................................................................................................. B-1
xx
Automatic Locks in DDL Operations.................................................................................................. B-4
Exclusive DDL Locks........................................................................................................................ B-4
Share DDL Locks............................................................................................................................... B-5
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-21
Oracle Compliance with SQL/PSM:2008 .......................................................................................... C-21
Oracle Compliance with SQL/MED:2008 ......................................................................................... C-21
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-26
Oracle Extensions to Standard SQL .................................................................................................. C-27
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
剩余1521页未读,继续阅读
点击了解资源详情
点击了解资源详情
点击了解资源详情
2011-12-06 上传
2011-08-11 上传
2009-03-12 上传
2009-03-12 上传
2015-06-26 上传
点击了解资源详情
shenfw1987
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功