Sunteți pe pagina 1din 6

Contents

Preface

I Course Introduction
Course Objectives I-2
Course Agenda I-3
Human Resources (HR) Schema I-5

1 Understanding the Oracle Database Environment


Objectives 1-2
Understanding the Oracle Database Environment 1-3
Getting to Know the Oracle Database 1-5
Demystifying Grid Computing 1-7
Exploring the Architectural Components 1-8
Understanding the Oracle Instance 1-12
Connecting to an Instance 1-14
Processing a SQL Statement 1-16
Understanding Data Flow During SQL Statement Processing 1-19
Using Bind Variables 1-21
Understanding Read Consistency 1-23
Summary 1-26
Practice 1: Overview 1-27

2 Working with iSQL*Plus


Objectives 2-2
Differentiating Between SQL Statements and iSQL*Plus Commands 2-3
Introducing iSQL*Plus 2-5
Logging In to iSQL*Plus 2-6
Understanding the iSQL*Plus Environment 2-7
Interacting with Script Files 2-8
Configuring Settings 2-10
Other Development Tools 2-12
Summary 2-13
Practice 2: Overview 2-14

3 Getting Started with Oracle SQL


Objectives 3-2
Retrieving Data by Using the SELECT Statement 3-3
Restricting Output by Using the WHERE Clause 3-5
Defining Null 3-7
Using Pseudocolumns 3-8
Manipulating Data Items by Using Operators 3-11
Calculating Using Arithmetic Expressions 3-13
Manipulating Strings by Using the Concatenation Operator 3-14
Combining Results by Using Set Operators 3-15
Using the UNION Operator 3-16

iii
Using Expressions 3-18
Conditional Querying Using the CASE Expression 3-19
Using Conditions 3-21
Understanding Functions 3-22
Two Types of SQL Functions 3-23
Manipulating Data Items Using Single-Row Functions 3-24
Using Numeric Functions 3-26
Using the ROUND and TRUNC Functions 3-27
Practice 3: Overview of Part 1 3-29
Understanding Data Types 3-30
Using Datetime Data Types 3-33
Using INTERVAL Data Types 3-37
Converting Between Data Types 3-40
Converting Data Types Explicitly 3-42
Displaying a Date in a Specific Format 3-43
Date Format Model Elements 3-44
Using the TO_CHAR Function with Dates and Numbers 3-47
Using the TO_NUMBER and TO_DATE Functions 3-50
Summary 3-51
Practice 3: Overview of Part 2 3-52

4 Combining Tables by Using Advanced Queries 4-1


Objectives 4-2
Understanding Subqueries 4-3
Using a Subquery 4-5
Using Multiple-Column Subqueries 4-6
Comparing Columns 4-7
Comparing Using Pairwise Comparison Subquery 4-8
Comparing Using Nonpairwise Comparison Subqueries 4-9
Row-By-Row Processing Using Correlated Subqueries 4-11
Updating Rows Using Correlated UPDATE Operations 4-14
Deleting Rows Using Correlated DELETE Operations 4-16
Top-N Analysis 4-17
Example of Top-N Analysis 4-19
Joining Tables Using Oracle Syntax 4-20
Retrieving Records with Equijoins 4-21
Qualifying Ambiguous Column Names 4-22
Understanding Nonequijoins 4-24
Using Outer Joins 4-25
Joining a Table to Itself 4-27
Comparing ANSI SQL Join Syntax with Oracle SQL Join Syntax 4-28
Using a Subquery in the FROM Clause 4-29
Using the Subquery Factoring Clause 4-30
Subquery Factoring Clause: Example 4-31
Retrieving Data Hierarchically 4-33
Sample Data from the EMPLOYEES Table 4-34
Natural Tree Structure 4-35
Hierarchical Queries 4-36

iv
“Walking” the Tree 4-38
Walking the Tree: From the Bottom Up 4-40
Walking the Tree: From the Top Down 4-41
Ranking Rows with the LEVEL Pseudocolumn 4-42
Formatting Hierarchical Reports Using LEVEL and LPAD 4-44
Pruning Branches 4-46
Summary 4-47
Practice 4: Overview 4-48

5 Creating and Managing Tables


Objectives 5-2
Displaying Table Structure 5-3
Referencing Another User’s Tables 5-5
The CREATE TABLE Statement 5-6
Creating a Table Using a Subquery 5-9
Altering Table Structure 5-11
Adding a Column 5-12
Modifying and Dropping Columns 5-13
Marking a Column as Unused 5-15
Guaranteeing Data Integrity 5-17
Understanding Constraints 5-19
Defining Constraints 5-20
Guidelines for Defining Constraints 5-23
Adding a Constraint 5-25
Disabling and Enabling Constraints 5-26
Deferring Constraint Checking 5-29
Changing the Enforcement of Constraints 5-30
Enforcing Primary and Unique Key Constraints 5-31
Maintaining Tables in a Foreign Key Relationship 5-32
Dropping a Constraint 5-34
Cascading Constraints 5-35
Renaming a Table 5-37
Truncating a Table 5-38
Dropping a Table 5-39
Adding Comments to a Table 5-40
Understanding the Types of Tables in the Oracle Database 5-41
Querying the Data Dictionary 5-43
Viewing Constraints 5-44
Summary 5-45
Practice 5: Overview 5-50

6 Creating and Managing Other Oracle Database Objects 6-1


Objectives 6-2
Understanding Database Objects 6-3
Understanding Indexes 6-4
Creating an Index 6-6
Confirming Indexes 6-9
Creating Function-Based Indexes 6-10
Creating an Index While Creating a Table 6-12
Removing an Index 6-14

v
Understanding Views 6-15
Differentiating Simple Views from Complex Views 6-16
Creating a View 6-17
Creating a Simple View 6-18
Creating a Complex View 6-20
Querying a View 6-22
Modifying a View 6-23
Performing DML Operations on a View 6-24
Using the WITH CHECK OPTION Clause 6-25
Denying DML Operations 6-27
Removing a View 6-28
Understanding Inline Views 6-29
Understanding Materialized Views 6-31
Comparing Materialized Views with Indexes 6-33
Creating a Materialized View 6-34
Understanding Sequences 6-35
Creating a Sequence 6-36
Confirming Sequences 6-38
Using a Sequence 6-39
Using a Sequence: Example 6-41
Caching Sequence Values 6-42
Altering a Sequence 6-44
Modifying Sequences: Guidelines 6-45
Removing a Sequence 6-46
Creating a Synonym for an Object 6-47
Creating and Removing Synonyms 6-48
Summary 6-49
Practice 6: Overview 6-51

7 Controlling User Access 7-1


Objectives 7-2
Controlling User Access 7-3
Understanding System Privileges 7-5
Creating Users 7-6
Granting System Privileges to a User 7-7
Granting System Privileges 7-8
Understanding Roles 7-9
Creating a Role 7-10
Changing Your Password 7-11
Understanding Object Privileges 7-12
Granting Object Privileges 7-14
Using the WITH GRANT OPTION and PUBLIC Keywords 7-15
Confirming Privileges Granted 7-17
Revoking Object Privileges 7-19
Understanding Database Links 7-20
Creating Database Links 7-22
Summary 7-24
Practice 7: Overview 7-25

vi
8 Oracle Database Extensions to DML and DDL Statements
Objectives 8-2
Using Multitable INSERT Statements 8-3
Using Unconditional INSERT ALL 8-8
Using Conditional FIRST INSERT 8-11
Using Pivoting INSERT 8-13
Merging Rows by Using the MERGE Statement 8-16
Understanding External Tables 8-19
Creating an External Table 8-20
Creating an External Table: Example 8-22
Querying External Tables 8-27
Understanding Database Transactions 8-28
Using the COMMIT and ROLLBACK Statements 8-30
Committing Changes 8-32
Rolling Back Changes 8-35
Understanding Statement-Level Rollbacks 8-36
Summary 8-37
Practice 8: Overview 8-38

Appendix A: Practice Solutions

Appendix B: Table Descriptions and Data

Appendix C: ANSI Joins

Appendix D: Advanced Features of Oracle SQL

Appendix E: Additional Practices

Appendix F: Additional Practice Solutions

vii

S-ar putea să vă placă și