
- •Objectivesj i
- •System Developmentl Lifei Cyclele
- •Data Storage on Differenti Mediaia
- •Relationall i l Database Concept
- •Relationall i l Database Definitioni i i
- •Data Modelsls
- •Entityi Relationshipl i ip Modell
- •Entityi Relationshipl i ip Modelingli Conventionsi
- •Entityi Relationshipl i ip Modelingli Conventionsi
- •Relationall i l Database Terminologyi l
- •Relatingl i Multiplel i le Tablesl
- •Relationall i l Database Propertiesi
- •Communicatingi i withi a RDBMS Usingi SQL
- •Relationall i l Database
- •Oracle8:l Objectj Relationall i l
- •Definingi i an Objectj
- •Usingi an Objectj Modell
- •Characteristicsi i of Objectj systems
- •Oraclele Completel Solutionl i
- •SQL Statements
- •About PL/SQL/
- •PL/SQL/ Environmenti
- •Benefitsi of PL/SQL/
- •Benefitsi of PL/SQL/
- •Benefitsi of PL/SQL/
- •Benefitsi of PL/SQL/
- •Benefitsi of PL/SQL/
- •Summary

I
Introduction

Objectivesj i
After completing this lesson, you should be able to do the following:
•• Discussi thet theoreticalt r ti l and physicali l aspectsts off a relationalr l ti l databaset
•• Describeri thet Oracler le implementationi l t ti off thet
RDBMS and ORDBMS
•• Describeri how SQL and PL/SQL/ arere used inin thet Oracler le productr t sett
•• Describeri thet use and benefitsfits off PL/SQL/
I-2

System Developmentl Lifei Cyclele
Strategy
and
Analysis
Design
Build
and
Document
Transition
Production
I-3

Data Storage on Differenti Mediaia
|
|
|
|
|
|
SALGRADE |
|
|
|
|
|
|
|
|
SALGRADE |
|
|
|
|
|
GRADE |
LOSAL |
HISAL |
|||
|
|
|
GRADE |
LOSAL |
HISAL |
|||
|
|
|
|
|
|
--------- --------- |
|
|
|
|
DEPT |
--------- |
|
|
|||
|
|
DEPT |
LOC |
1 |
|
700 |
1200 |
|
|
DEPTNO DNAME |
1 |
|
700 |
1200 |
|
||
|
DEPTNO DNAME |
LOC |
2 |
|
1201 |
1400 |
|
|
|
--------- -------------- ----------2 |
|
1201 |
1400 |
|
|||
|
|
10 |
|
3 |
|
1401 |
2000 |
|
|
|
|
NEW3 |
|
1401 |
2000 |
|
|
|
|
10 ACCOUNTING |
NEW |
|
2001 |
3000 |
|
|
|
YORK |
|
|
4 |
|
|
||
|
|
|
4 |
|
2001 |
3000 |
|
|
|
YORK |
|
|
5 |
|
3001 |
9999 |
|
|
20 |
RESEARCH |
DALLAS |
5 |
|
3001 |
9999 |
|
|
20 |
DALLAS |
|
|
|
|
|
|
|
30 SALES |
CHICAGO |
|
|
|
|
|
|
|
30 SALES |
CHICAGO |
|
|
|
|
|
|
|
40 |
OPERATIONS |
BOSTON |
|
|
|
|
|
|
40 |
BOSTON |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Database
Electronic |
Filing cabinet |
spreadsheet |
|
I-5

Relationall i l Database Concept
•• Drr.. E.. F.. Codd proposedr thet relationalr l ti l modell forf r databaset systemst inin 1970..
•• ItIt isis thet basisis forf r thet relationalr l ti l databaset managementt systemt (RDBMS)( )..
•• The relationalr l ti l modell consistsi ts off thet following:f ll i :
–– Collectionll ti off objectsj ts orr relationsr l ti
–– Sett off operatorsr t rs toto actt on thet relationsr l ti
–– Datata integrityi t rity forf r accuracyr and consistencyi t
I-6

Relationall i l Database Definitioni i i
A relational database is a collection of relations or two-dimensional tables.
Database
Table Name: EMP
|
|
|
|
|
|
|
EMPNO |
ENAME |
JOB |
DEPTNO |
|
|
EMPNO |
ENAME |
JOB |
DEPTNO |
|
|
7839 |
KING |
PRESIDENT |
10 |
|
|
7839 |
KING |
10 |
|
|
|
7698 |
BLAKE |
MANAGER |
30 |
|
|
7698 |
BLAKE |
MANAGER |
30 |
|
|
7782 |
CLARK |
MANAGER |
10 |
|
|
7782 |
CLARK |
MANAGER |
10 |
|
|
7566 |
JONES |
MANAGER |
20 |
|
|
7566 |
JONES |
MANAGER |
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
Table Name: DEPT
|
|
|
|
|
|
DEPTNO |
DNAME |
LOC |
|
|
DEPTNO |
DNAME |
LOC |
|
|
10 |
ACCOUNTING |
NEW YORK |
|
|
10 |
NEW YORK |
|
|
|
20 |
RESEARCH |
DALLAS |
|
|
20 |
DALLAS |
|
|
|
30 |
SALES |
CHICAGO |
|
|
30 |
SALES |
CHICAGO |
|
|
40 |
OPERATIONS |
BOSTON |
|
|
40 |
BOSTON |
|
|
|
|
|
|
|
|
|
|
|
|
I-7

Data Modelsls
Model of |
|
|
system |
Entity model of |
|
in client’s |
||
client’s model |
||
mind |
||
|
Table model |
|
of entity model |
Server |
|
Tables on disk
I-8

Entityi Relationshipl i ip Modell
•• Creater te an entitytity relationshipr l ti ip diagrami r fromfr businessi specificationsifi ti orr narrativesrr ti
EMPLOYEE |
|
assigned to |
DEPARTMENT |
||||
#** |
numberr |
#** |
numberr |
||||
|
|||||||
** |
name |
composed of |
** |
name |
|||
o |
job title |
o |
location |
||||
|
j |
title |
|
|
l |
ti |
•• Scenariorio
–– ““.. .. ..Assigni one orr morere employeesl toto a departmentrt t .. .. ..””
–– ““.. .. .. Some departmentsrt ts do nott yett have assignedi employeesl .. .. ..””
I-9

Entityi Relationshipl i ip Modelingli Conventionsi
Entity |
|
Attribute |
|
Soft box |
Singular name |
||
Singular, unique name |
Lowercase |
||
Uppercase |
Mandatory marked with “*” |
||
Synonym in parentheses |
Optional marked with “o” |
EMPLOYEE |
|
assigned to |
DEPARTMENT |
|||
#** |
numberr |
|
#** |
numberr |
||
** |
name |
composed of |
** |
name |
||
o |
job title |
o |
location |
|||
|
j |
title |
|
|
l |
ti |
Unique Identifier (UID)
Primary marked with “#”
Secondary marked with “(#)”
I-10

Entityi Relationshipl i ip Modelingli Conventionsi
Entity |
|
Attribute |
|
Soft box |
Singular name |
||
Singular, unique name |
Lowercase |
||
Uppercase |
Mandatory marked with “*” |
||
Synonym in parentheses |
Optional marked with “o” |
EMPLOYEE |
|
assigned to |
DEPARTMENT |
|||
#** |
numberr |
|
#** |
numberr |
||
** |
name |
composed of |
** |
name |
||
o |
job title |
o |
location |
|||
|
j |
title |
|
|
l |
ti |
Unique Identifier (UID)
Primary marked with “#”
Secondary marked with “(#)”
I-11

Relationall i l Database Terminologyi l
|
|
2 |
|
3 |
|
|
|
|
|
4 |
|
|
|
EMPNO |
ENAME |
JOB |
MGR |
HIREDATE |
SAL |
COMM |
DEPTNO |
|
|
|
|
------------- |
------------ |
--------------------- |
6 |
---------------- |
----------- |
-------------- |
----------- |
|
|
|
|
7839 |
KING |
PRESIDENT |
|
17-NOV-81 |
5000 |
|
|
10 |
|
|
|
7698 |
BLAKE |
MANAGER |
7839 |
01-MAY-81 |
2850 |
|
|
30 |
|
|
|
7782 |
CLARK |
MANAGER |
7839 |
09-JUN-81 |
2450 |
|
|
10 |
|
|
|
7566 |
JONES |
MANAGER |
7839 |
02-APR-81 |
2975 |
|
|
20 |
|
|
|
7654 |
MARTIN |
SALESMAN |
7698 |
28-SEP-81 |
1250 |
|
1400 |
30 |
|
|
|
7499 |
ALLEN |
SALESMAN |
7698 |
20-FEB-81 |
1600 |
5 |
300 |
30 |
|
|
|
7844 |
TURNER |
SALESMAN |
7698 |
08-SEP-81 |
1500 |
0 |
30 |
|
|
|
|
7900 |
JAMES |
CLERK |
7698 |
03-DEC-81 |
950 |
|
|
30 |
|
|
|
7521 |
WARD |
SALESMAN |
7698 |
22-FEB-81 |
1250 |
|
500 |
30 |
|
|
|
7902 |
FORD |
ANALYST |
7566 |
03-DEC-81 |
3000 |
|
|
20 |
|
|
|
7369 |
SMITH |
CLERK |
7902 |
17-DEC-80 |
800 |
|
|
20 |
|
|
|
7788 |
SCOTT |
ANALYST |
7566 |
09-DEC-82 |
3000 |
|
|
20 |
|
1 |
|
7876 |
ADAMS |
CLERK |
7788 |
12-JAN-83 |
1100 |
|
|
20 |
|
|
7934 |
MILLER |
CLERK |
7782 |
23-JAN-82 |
1300 |
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I-12