没有合适的资源?快使用搜索试试~ 我知道了~
首页Oracle 11g R2数据库SQL语言参考指南
Oracle 11g R2数据库SQL语言参考指南
需积分: 9 11 下载量 82 浏览量
更新于2024-07-25
收藏 11.3MB PDF 举报
"Oracle® Database SQL Language Reference 11g Release 2 (11.2)" 是Oracle公司发布的关于11g R2版本数据库的SQL语言官方参考指南,由Diana Lorentz和Mary Beth Roeser等人主要编写,并有多位贡献者参与。该文档详细介绍了在Oracle 11g R2环境中使用SQL进行数据查询、操作和管理的各种语法和功能。
在Oracle 11g R2中,SQL(结构化查询语言)是用于与关系型数据库交互的核心工具,它支持多种操作,包括但不限于:
1. **数据查询**:使用SELECT语句来检索数据库中的信息。你可以通过指定列、表、条件和聚合函数来定制查询结果。例如,`SELECT column1, column2 FROM table WHERE condition;`
2. **数据插入**:INSERT语句用于向表中添加新记录。例如,`INSERT INTO table (column1, column2) VALUES (value1, value2);`
3. **数据更新**:UPDATE语句用于修改现有记录的值。例如,`UPDATE table SET column = newValue WHERE condition;`
4. **数据删除**:DELETE语句用于从表中移除记录。例如,`DELETE FROM table WHERE condition;`
5. **数据定义**:CREATE TABLE语句用于创建新的数据库表,而ALTER TABLE和DROP TABLE分别用于修改和删除已存在的表。
6. **索引管理**:可以创建和管理索引来提高查询性能。CREATE INDEX用于创建索引,ALTER INDEX用于调整,而DROP INDEX用于删除。
7. **视图**:使用CREATE VIEW语句创建虚拟表,它们基于一个或多个表的查询结果。视图可以简化复杂的查询,并提供数据的安全性。
8. **存储过程和函数**:用户可以定义自己的存储过程和函数,将一系列SQL语句打包在一起,以便重复使用或执行更复杂的逻辑。
9. **事务处理**:Oracle支持ACID(原子性、一致性、隔离性和持久性)属性,允许在数据库中进行事务操作,确保数据的一致性。
10. **游标**:在处理多行结果集时,游标提供了一种逐行访问数据的方法,这对于循环处理或有条件地处理结果集非常有用。
11. **子查询**:在查询中嵌套SQL查询,以获取满足特定条件的数据。
12. **连接操作**:使用JOIN语句将来自不同表的数据组合在一起,如INNER JOIN、LEFT JOIN、RIGHT JOIN和FULL OUTER JOIN。
13. **分组和聚合**:GROUP BY和HAVING子句用于根据一个或多个列对数据进行分组,并使用聚合函数(如COUNT、SUM、AVG和MAX)对每个组进行计算。
14. **窗口函数**:在11g R2中,引入了窗口函数,如ROW_NUMBER、RANK、DENSE_RANK和LEAD/LAG,它们在分组和排序之外提供了更高级的分析功能。
15. **分区表**:大型数据库通常使用分区技术来提高查询性能和管理大量数据。Oracle 11g R2支持多种分区策略,如范围分区、列表分区、哈希分区和复合分区。
此外,Oracle 11g R2还引入了许多增强特性,如Advanced Analytics、Real Application Clusters (RAC)、Automatic Storage Management (ASM)、Data Guard以及Oracle Data Mining等,这些都极大地扩展了SQL的功能并提高了数据库管理的效率。
"Oracle® Database SQL Language Reference 11g Release 2 (11.2)"是学习和理解Oracle数据库系统中SQL语言的权威资料,无论你是初学者还是经验丰富的DBA,都能从中找到所需的信息。
xvi
deallocate_unused_clause .................................................................................................................... 8-27
file_specification ................................................................................................................................... 8-29
logging_clause ........................................................................................................................................ 8-38
parallel_clause........................................................................................................................................ 8-41
physical_attributes_clause .................................................................................................................. 8-44
size_clause .............................................................................................................................................. 8-47
storage_clause ........................................................................................................................................ 8-48
9 SQL Queries and Subqueries
About Queries and Subqueries ............................................................................................................ 9-1
Creating Simple Queries ........................................................................................................................ 9-2
Hierarchical Queries ............................................................................................................................... 9-3
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-11
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-15
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-46
ALTER DIMENSION ........................................................................................................................ 10-48
ALTER DISKGROUP ........................................................................................................................ 10-51
ALTER FLASHBACK ARCHIVE .................................................................................................... 10-74
ALTER FUNCTION ........................................................................................................................... 10-77
ALTER INDEX .................................................................................................................................... 10-78
ALTER INDEXTYPE .......................................................................................................................... 10-97
xvii
ALTER JAVA ...................................................................................................................................... 10-100
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
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
xviii
CREATE EDITION ............................................................................................................................. 14-52
CREATE FLASHBACK ARCHIVE ................................................................................................. 14-56
CREATE FUNCTION ........................................................................................................................ 14-59
CREATE INDEX ................................................................................................................................. 14-61
CREATE INDEXTYPE ....................................................................................................................... 14-87
CREATE JAVA ..................................................................................................................................... 14-91
15 SQL Statements: CREATE LIBRARY to CREATE SPFILE
CREATE LIBRARY ............................................................................................................................... 15-2
CREATE MATERIALIZED VIEW ..................................................................................................... 15-3
CREATE MATERIALIZED VIEW LOG ......................................................................................... 15-26
CREATE OPERATOR ........................................................................................................................ 15-34
CREATE OUTLINE ............................................................................................................................ 15-37
CREATE PACKAGE ........................................................................................................................... 15-41
CREATE PACKAGE BODY .............................................................................................................. 15-43
CREATE PFILE .................................................................................................................................... 15-45
CREATE PROCEDURE ..................................................................................................................... 15-47
CREATE PROFILE ............................................................................................................................. 15-49
CREATE RESTORE POINT ............................................................................................................. 15-55
CREATE ROLE .................................................................................................................................... 15-58
CREATE ROLLBACK SEGMENT .................................................................................................. 15-61
CREATE SCHEMA ............................................................................................................................. 15-64
CREATE SEQUENCE ........................................................................................................................ 15-66
CREATE SPFILE ................................................................................................................................. 15-70
16 SQL Statements: CREATE SYNONYM to CREATE TRIGGER
CREATE SYNONYM ........................................................................................................................... 16-2
CREATE TABLE .................................................................................................................................... 16-6
CREATE TABLESPACE ..................................................................................................................... 16-81
CREATE TRIGGER ............................................................................................................................ 16-95
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
xix
DROP FLASHBACK ARCHIVE ..................................................................................................... 17-46
DROP FUNCTION ............................................................................................................................ 17-47
DROP INDEX....................................................................................................................................... 17-49
DROP INDEXTYPE ........................................................................................................................... 17-51
DROP JAVA ......................................................................................................................................... 17-52
DROP LIBRARY ................................................................................................................................. 17-53
DROP MATERIALIZED VIEW........................................................................................................ 17-54
DROP MATERIALIZED VIEW LOG ............................................................................................. 17-56
DROP OPERATOR ............................................................................................................................ 17-58
DROP OUTLINE ................................................................................................................................ 17-59
DROP PACKAGE ............................................................................................................................... 17-61
DROP PROCEDURE ......................................................................................................................... 17-63
DROP PROFILE .................................................................................................................................. 17-64
DROP RESTORE POINT ................................................................................................................. 17-65
DROP ROLE ........................................................................................................................................ 17-66
DROP ROLLBACK SEGMENT ...................................................................................................... 17-67
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-63
xx
TRUNCATE CLUSTER ..................................................................................................................... 19-66
TRUNCATE TABLE ........................................................................................................................... 19-68
UPDATE ............................................................................................................................................... 19-72
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
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
剩余1515页未读,继续阅读
138 浏览量
点击了解资源详情
点击了解资源详情
109 浏览量
2015-07-03 上传
点击了解资源详情
点击了解资源详情
点击了解资源详情
海兰
- 粉丝: 246
- 资源: 44
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- AN1299_Source_Code_dsPIC33CK256MP508_MCLV_MCHV_PLL_ESTIMATOR.zip
- 算法问题:存储我解决的部分算法问题
- Examcookie-crx插件
- 篮球赛工作总结下载
- movie-frontend
- l love youc#版.zip
- 下周:App ECOLETA,下周火箭比赛
- 公益小站-crx插件
- java版sm4源码-alg-sm2-demo:SM2密码算法JAVA调用演示程序
- java se写的坦克游戏.zip
- 小学2013年工作总结
- upptime:Ne Neal Daringer的正常运行时间监视和状态页面,由@upptime提供支持
- local-stack-demo-service
- spring图书管理系统.zip
- ProCyclingStats:从ProCyclingStats网站下载车手统计信息
- Kaggle_Otto_Product_Classification:Kaggle Otto Group 产品分类
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功