Академический Документы
Профессиональный Документы
Культура Документы
Introduction
Objectives
After completing this lesson, you should be able to do the following: Discuss the theoretical and physical aspects of a relational database Describe the Oracle implementation of the RDBMS and ORDBMS Describe how SQL and PL/SQL are used in the Oracle product set Describe the use and benefits of PL/SQL
I-2
Copyright Oracle Corporation, 1998. All rights reserved.
I-3
Filing cabinet
Copyright Oracle Corporation, 1998. All rights reserved.
I-6
MANAGER 30 40 OPERATIONS MANAGER Copyright Oracle Corporation, 1998. All rights reserved. MANAGER 20
Data Models
Server
Tables on disk
I-8
Copyright Oracle Corporation, 1998. All rights reserved.
assigned to
Scenario . . . Assign one or more employees to a department . . . . . . Some departments do not yet have assigned employees . . .
I-9
Copyright Oracle Corporation, 1998. All rights reserved.
assigned to
composed of
Unique Identifier (UID) Primary marked with # Secondary marked with (#)
I-10
Copyright Oracle Corporation, 1998. All rights reserved.
3
MGR HIREDATE SAL
4
COMM DEPTNO ----------10 30 10 20 1400 300 30 30 30 30 500 30 20 20
------------- ------------ --------------------- -------- ---------------- ----------- -------------7839 KING 7698 BLAKE 7782 CLARK 7566 JONES 7654 MARTIN 7499 ALLEN PRESIDENT MANAGER MANAGER MANAGER SALESMAN SALESMAN 7839 7839 7839 7698 7698 7698 7698 7698 7566 7902 17-NOV-81 01-MAY-81 09-JUN-81 02-APR-81 28-SEP-81 20-FEB-81 08-SEP-81 03-DEC-81 22-FEB-81 03-DEC-81 17-DEC-80 5000 2850 2450 2975 1250 1600 1500 950 1250 3000 800
7844 TURNER SALESMAN 7900 JAMES 7521 WARD 7902 FORD 7369 SMITH CLERK SALESMAN ANALYST CLERK
7788
7876
SCOTT
ADAMS MILLER
ANALYST
CLERK CLERK
7566
7788 7782
09-DEC-82
12-JAN-83 23-JAN-82
3000
1100 1300
20
20 10
1
I-12
7934
You can logically relate data from multiple tables using foreign keys (FK).
Table Name: EMP
EMPNO DEPTNO 7839 10 7698 ENAME KING BLAKE JOB PRESIDENT MANAGER 30
7782 10 7566
CLARK
JONES
MANAGER
MANAGER 20
Primary key
I-13
Foreign key
Primary key
I-14
Database
Data is displayed
LOC ------------NEW YORK DALLAS CHICAGO BOSTON
I-15
User tables
I-16
Copyright Oracle Corporation, 1998. All rights reserved.
Data dictionary
I-17
Defining an Object
An object
Customers
I-19
Business
SQL
PL/SQL
SQL* Plus
Oracle7/8
Database
I-21
SQL Statements
SELECT INSERT UPDATE DELETE CREATE ALTER DROP RENAME TRUNCATE COMMIT ROLLBACK SAVEPOINT GRANT REVOKE
I-22
Data retrieval
Transaction control
About PL/SQL
PL/SQL is an extension to SQL with design features of programming languages. Data manipulation and query statements of SQL are included within procedural units of code.
I-23
PL/SQL Environment
PL/SQL engine PL/SQL block PL/SQL block PL/SQL SQL Procedural Statement Executor
I-24
1400 300 0
DEPT
DEPTNO --------10 20 30 40
7521 DNAMEWARD 7902 FORD -------------7369 SMITH ACCOUNTING 7788 SCOTT RESEARCH 7876 SALESADAMS 7934 MILLER OPERATIONS
SALESMAN LOC ANALYST ---------CLERK NEW YORK ANALYST DALLAS CLERK CHICAGO CLERK BOSTON
1250 500 30 SALGRADE 3000 20 800 20 GRADE LOSAL HISAL 3000 --------- --------20 --------1100 1 20 700 1200 1300 2 10 1201 1400 3 1401 2000 4 2001 3000 5 3001 9999
I-25
Summary
Relational databases are composed of relations, managed by relational operations, and governed by data integrity constraints. The Oracle Server allows you to store and manage information by using the SQL language and PL/SQL engine. PL/SQL is an extension to SQL with design features of programming languages.
I-26
Copyright Oracle Corporation, 1998. All rights reserved.