iii
Contents
Volume 1
Preface xi....................................................................
Profile xii.................................................................
Related Publications xviii....................................................
Typographic Conventions xix................................................
I Introduction IĆ1...........................................................
Course Objectives IĆ3......................................................
Course Outline IĆ5.........................................................
The Relational Database Concept IĆ9........................................
System Development Cycle IĆ17..............................................
What Is Oracle? IĆ19........................................................
The Oracle Product Set IĆ21..................................................
SQL, SQL*Plus, and PL/SQL IĆ23.............................................
Summit Sporting Goods Demonstration Tables IĆ29.............................
Summary IĆ33..............................................................
1. Selecting Rows 1Ć1........................................................
Objectives 1Ć3.............................................................
The Basic Query Block 1Ć5..................................................
Arithmetic Expressions 1Ć13..................................................
Column Aliases 1Ć21........................................................
The Concatenation Operator 1Ć23.............................................
Literal Character String 1Ć25..................................................
Managing Null Values 1Ć27...................................................
Preventing the Selection of Duplicate Rows 1Ć31................................
SQL*Plus Commands 1Ć35...................................................
Logging in to SQL*Plus 1Ć37.................................................
Displaying Table Structure 1Ć39...............................................
SQL*Plus Editing Commands 1Ć41............................................
SQL*Plus File Commands and Online Help 1Ć43................................
Creating a Report 1Ć45.......................................................
Summary 1Ć51..............................................................
Practice Overview 1Ć53......................................................
Practice 1 1Ć55..............................................................
2. Limiting Selected Rows 2Ć1................................................
Objectives 2Ć3.............................................................
Ordering Rows with the ORDER BY Clause 2Ć5................................
Limiting Selected Rows with the WHERE Clause 2Ć11............................
Comparison Operators 2Ć13..................................................
iv
Negating Expressions 2Ć17...................................................
SQL Operators 2Ć19.........................................................
Querying Data with Multiple Conditions 2Ć27....................................
Rules of Precedence 2Ć29....................................................
Summary 2Ć33..............................................................
Practice Overview 2Ć35......................................................
Practice 2 2Ć37..............................................................
3. Single Row Functions 3Ć1..................................................
Objectives 3Ć3.............................................................
Overview 3Ć5..............................................................
Single Row Functions 3Ć7...................................................
Character Functions 3Ć9....................................................
Number Functions 3Ć17......................................................
Oracle Date Format 3Ć23.....................................................
Using Arithmetic Operators with Dates 3Ć25....................................
Date Functions 3Ć27.........................................................
Conversion Functions 3Ć33...................................................
TO_CHAR Function with Date Formats 3Ć35....................................
TO_CHAR Function with Number Formats 3Ć45.................................
TO_NUMBER and TO_DATE Functions 3Ć49....................................
Nesting Single Row Functions 3Ć51............................................
Nesting Functions 3Ć53......................................................
Summary 3Ć55..............................................................
Practice Overview 3Ć57......................................................
Practice 3 3Ć59..............................................................
4. Displaying Data from Multiple Tables 4Ć1....................................
Objectives 4Ć3.............................................................
Overview 4Ć5..............................................................
What Is a Cartesian Product? 4Ć7............................................
Simple Join Query 4Ć9......................................................
Using Table Aliases 4Ć17.....................................................
NonĆEquijoin 4Ć19...........................................................
Returning Records with No Direct Match 4Ć21...................................
Joining a Table to Itself 4Ć25..................................................
Summary 4Ć27..............................................................
Practice Overview 4Ć29......................................................
Practice 4 4Ć31..............................................................
5. Group Functions 5Ć1.......................................................
Objectives 5Ć3.............................................................
Overview 5Ć5..............................................................
Group Functions 5Ć7.......................................................
v
The GROUP BY Clause 5Ć13..................................................
Illegal Queries Using Group Functions 5Ć19....................................
Groups Within Groups 5Ć23..................................................
The HAVING Clause 5Ć25....................................................
Summary 5Ć31..............................................................
Practice Overview 5Ć33......................................................
Practice 5 5Ć34..............................................................
6. Subqueries 6Ć1............................................................
Objectives 6Ć3.............................................................
Overview 6Ć5..............................................................
Subqueries 6Ć7............................................................
How Are Nested Subqueries Processed? 6Ć9..................................
Single Row Subqueries 6Ć11..................................................
Errors with Subqueries 6Ć15..................................................
Multiple Row Subqueries 6Ć17................................................
HAVING Clause with Nested Subqueries 6Ć19..................................
Summary 6Ć21..............................................................
Practice Overview 6Ć23......................................................
Practice 6 6Ć25..............................................................
Volume 2
7. Specifying Variables at Runtime 7Ć1........................................
Objectives 7Ć3.............................................................
Overview 7Ć5..............................................................
Substitution Variables 7Ć7...................................................
Single Ampersand Substitution Variables 7Ć9..................................
Defining User Variables 7Ć15..................................................
Passing Values into a Script File 7Ć21..........................................
Summary 7Ć23..............................................................
Practice Overview 7Ć25......................................................
Practice 7 7Ć26..............................................................
8. Overview of Data Modeling and Database Design 8Ć1........................
Objectives 8Ć3.............................................................
Overview 8Ć5..............................................................
System Development Cycle 8Ć7..............................................
Database Design 8Ć9.......................................................
Data Model 8Ć11............................................................
Entity Relationship Modeling 8Ć13.............................................
Entity Relationship Model Concepts 8Ć15.......................................
Integrity Constraints and Keys 8Ć23............................................
Designing the Database 8Ć29.................................................
Summary 8Ć39..............................................................
vi
9. Creating Tables 9Ć1........................................................
Objectives 9Ć3.............................................................
Overview 9Ć5..............................................................
Creating Tables 9Ć7.........................................................
Oracle7 Datatypes 9Ć13......................................................
Constraints 9Ć15............................................................
Creating a Table from a Table Instance Chart 9Ć25...............................
Creating a Table from Rows in Another Table 9Ć31...............................
Confirming Table Creation 9Ć33...............................................
Summary 9Ć35..............................................................
Practice Overview 9Ć37......................................................
Practice 9 9Ć39..............................................................
10. Oracle Data Dictionary 10Ć1.................................................
Objectives 10Ć3.............................................................
Overview 10Ć5..............................................................
Querying the Data Dictionary 10Ć7.............................................
Checking Constraints on a Table 10Ć13.........................................
Summary 10Ć17..............................................................
Practice Overview 10Ć19......................................................
Practice 10 10Ć21............................................................
11. Manipulating Data 11Ć1.....................................................
Objectives 11Ć3.............................................................
Overview 11Ć5..............................................................
Adding a New Row to a Table 11Ć7............................................
Copying Rows from Another Table 11Ć19........................................
Updating Rows 11Ć21.........................................................
Deleting Rows 11Ć29..........................................................
Transaction Processing 11Ć35..................................................
Committing Changes 11Ć39...................................................
Rolling Back Changes 11Ć43...................................................
Rolling Back Changes to a Savepoint 11Ć45.....................................
Statement Level Rollback 11Ć47................................................
Summary 11Ć49..............................................................
Practice Overview 11Ć51......................................................
Practice 11 11Ć53............................................................
12. Altering Tables and Constraints 12Ć1.........................................
Objectives 12Ć3.............................................................
Overview 12Ć5..............................................................
Adding a Column 12Ć7.......................................................
Modifying a Column 12Ć9....................................................
Adding and Dropping a Constraint 12Ć11........................................
vii
Disabling and Enabling a Constraint 12Ć15......................................
Dropping a Table 12Ć17.......................................................
Renaming and Truncating a Table 12Ć19........................................
Adding a Comment to a Table 12Ć21............................................
Summary 12Ć23..............................................................
Practice Overview 12Ć25......................................................
Practice 12 12Ć27............................................................
13. Creating Sequences 13Ć1...................................................
Objectives 13Ć3.............................................................
Overview 13Ć5..............................................................
Creating a Sequence 13Ć7....................................................
Using a Sequence 13Ć13......................................................
Altering a Sequence 13Ć17....................................................
Removing a Sequence 13Ć19..................................................
Summary 13Ć21..............................................................
Practice Overview 13Ć23......................................................
Practice 13 13Ć25............................................................
14. Creating Views 14Ć1........................................................
Objectives 14Ć3.............................................................
Overview 14Ć5..............................................................
Creating a View 14Ć7........................................................
Performing DML Operations on a View 14Ć15....................................
Confirming View Names and Structures 14Ć21...................................
Removing a View 14Ć23.......................................................
Summary 14Ć25..............................................................
Practice Overview 14Ć27......................................................
Practice 14 14Ć29............................................................
15. Creating Indexes 15Ć1......................................................
Objectives 15Ć3.............................................................
Overview 15Ć5..............................................................
When Is the Index Used? 15Ć7................................................
Index Structure 15Ć9.........................................................
Creating an Index 15Ć13.......................................................
Confirming Indexes 15Ć17.....................................................
Removing an Index 15Ć19.....................................................
Summary 15Ć21..............................................................
Practice Overview 15Ć23......................................................
Practice 15 15Ć25............................................................
16. Controlling User Access 16Ć1...............................................
Objectives 16Ć3.............................................................
Overview 16Ć5..............................................................