Sunteți pe pagina 1din 54

Chapter 1:

Client/Server Databases and the

Oracle 10g Relational Database

Guide to Oracle 10g


Develop an understanding of the purpose of

database systems
Describe the purpose and contents of an entity-
relationship model
Explain the steps in the normalization process
Describe the differences between personal and
client/server databases

Guide to Oracle 10g 2

Objectives (continued)

Understand the Northwoods University student

registration database and the Clearwater Traders
sales order database

Guide to Oracle 10g 3

If an organization needs to store and maintain a
large amount of data that must be viewed and
updated by many users at the same time, it often
uses a client/server database such as Oracle 10g.

Guide to Oracle 10g 4

Database Systems

Data files consist of:

Describe characteristics
Also called columns
Group of related fields

Guide to Oracle 10g 5

Database Systems (continued)

Problems with storing data in files:

Proliferation of data management programs
Presence of redundant data
Inconsistent data
Stores all organizational data in central location
Eliminates redundant data to reduce possibility of
inconsistent data

Guide to Oracle 10g 6

Database Systems (continued)

Database management system (DBMS)

Application that performs all routine data-handling
Provides central set of common functions for
managing database
Deleting data values
Guide to Oracle 10g 7
Database Approach to Data

Guide to Oracle 10g 8

Database Systems (continued)

Database administrator
Person responsible for installing, administering,
and maintaining the database
Often called DBA

Guide to Oracle 10g 9

Overview of Relational Databases

Matrix with columns and rows
Represent different data fields
Characteristics or attributes about entity
Contain individual records
Attributes about a specific instance of entity

Guide to Oracle 10g 10

Overview of Relational Databases

Guide to Oracle 10g 11

Overview of Relational Databases
Object about which you want to store data
Different tables store data about each different
Links that show how different records are related

Guide to Oracle 10g 12

Overview of Relational Databases
Key fields
Establish relationships among records in different
Main types of key fields
Guide to Oracle 10g 13
Primary Keys

Column in relational database table whose value

must be unique for each row
Serves to identify individual occurrence of entity
Every row must have a primary key
Cannot be NULL
Value is absent or unknown
No entry is made for that data element

Guide to Oracle 10g 14

Candidate Keys

Any column that could be used as the primary key

Should be a column that is unique for each record
and does not change

Guide to Oracle 10g 15

Surrogate Keys

Column created to be records primary key

Has no real relationship to row to which it is
assigned other than to identify it uniquely
Surrogate key values automatically generated
using a sequence

Guide to Oracle 10g 16

Foreign Keys
Column in table that is a primary key in another table
Creates relationship between two tables
Value must exist in table where it is the primary key

Guide to Oracle 10g 17

Composite Keys
Unique key that is created by combining two or more
Usually comprises fields that are primary keys in other

100 1 2
100 2 2
200 2 2
200 1 1
Guide to Oracle 10g 18
Database Design

Main tasks involved with design of database:

Developing entity-relationship (ER) model
Normalizing database tables

Guide to Oracle 10g 19

Entity-Relationship Model

Designed to help you identify which entities need

to be included in database
Composed of
Squares representing entities
Lines representing relationships
Types of relationships:
One to one (1:1)
One to many (1:M)
Many to many (N:M)
Guide to Oracle 10g 20
Entity-Relationship Model (continued)

One to one (1:1)

Each occurrence of a specific entity (instance) is
found only once in each set of data
E.g. birth certificates - individuals
Rare in relational databases
One to many (1:M)
Instance can only appear once in one entity, but
one or more times in the other entity
E.g. publisher - books
Guide to Oracle 10g 21
Entity-Relationship Model (continued)

Many to many (N:M)

Instance can occur multiple times in each entity
Cannot be represented in physical database
Broken down into series of two or more 1:M
relationships through use of linking table in process
of normalization
E.g. students - classes

Guide to Oracle 10g 22


Step-by-step process used to determine which data

elements should be stored in which tables
Eliminate data redundancy
Several levels of normalization

Guide to Oracle 10g 23

Normalization (continued)
Unnormalized data
Does not have a primary key identified
and/or Contains repeating groups
e.g. Repeating groups (course_no, course_name,
credits, grade) fields for students JO100 and
First normal form (1NF)
Repeating groups removed by creating a separate
record for each value in the repeating group
Primary key field identified (use composite key
Guide to Oracle 10g+ Course_no) 24
Example of Unnormalized Data

Guide to Oracle 10g 25

Normalization (continued)

Second normal form (2NF)

In 1NF
No partial dependencies
Partial dependency
Fields within the table are dependent only on part
of the primary key, this can only exist if there is a
composite primary key
Look at each field that is not part of the composite
primary key and make certain you are required to
Guide to Oracle 10gBOTH parts of the composite field to 26
determine the value of the data element
Normalization (continued)
Second normal form (2NF) continued.
E.g. is the value in course_name field determined by the
combination of both S_ID and course_ID?
No, it depends on just the course_ID. So you have at least one
partial dependency.
To remove partial depedencies list each part of the composite key
and the entire composite key as separate entries, then determine
which fields is determined by each portion of the composite key
which divides data into different tables.
Student(S_ID, S_last, S_address, S_state, S_zip, F_ID, F_last)
Course(Course_no, course_name, credits)
Enrollment(S_ID + Course_no, Grade)
Enrollment table is the linking table that now has a 1:M
relationship with Student table and 1:M with Course table
Guide to Oracle 10g 27
Normalization (continued)

Third normal form (3NF)

In 2NF
No transitive dependencies
Transitive dependency
Field is dependent on another field within the table that is not the
primary key field
Enrollment and Course tables are in 3NF
Student table is not in 3NF, F_last depends on F_ID
F_last should be removed from the Student table and put in a new
table called Faculty.
Faculty(F_ID, F_last)
Student(S_ID, S_last, S_address, S_state, S_zip, F_ID)
to Oracle
F_ID10gin student table is foreign key that links it to Faculty table 28
Database Systems

Consists of
Manages physical storage and data retrieval
Database applications
Provide interface that allows users to interact with
Computer that shares resources with other
Guide to Oracle 10g 29
Database Systems (continued)

Server process
Program that listens for requests for resources from
Responds to requests
Program that requests and uses server resources

Guide to Oracle 10g 30

Personal Database Management
DBMS and database applications run on same
Appear to user as a single integrated application
Used primarily for creating single-user database
Can also be used for some multiuser applications
Should be used only for applications that are not
mission critical

Guide to Oracle 10g 31

Personal Database Management
Systems (continued)

Microsoft Access
Stores all data for database in a single file with an
.mdb extension
Database administrator stores .mdb file on a central
file server

Guide to Oracle 10g 32

Using a Personal Database for a
Multiuser Application

Guide to Oracle 10g 33

Personal Database Management
Systems (continued)

Transaction processing
Grouping related database changes into units of
work that must either all succeed or all fail
DBMS can use the transaction log to reverseor
roll backthe changes

Guide to Oracle 10g 34

Client/Server Database Management
DBMS server process runs on one workstation
Database applications run on separate client
workstations across network
Server sends only requested data back to client
rather than entire database

Guide to Oracle 10g 35

Client/Server Database Architecture

Guide to Oracle 10g 36

Client/Server Database Management
Systems (continued)

Generate less network traffic than personal

Extra features to minimize chance of failure
Powerful recovery mechanisms that often operate
Maintain file-based transaction log on database

Guide to Oracle 10g 37

Client/Server Database Management
Systems (continued)

Preferred for
Database applications that retrieve and manipulate
small amounts of data from databases containing
large numbers of records
Mission-critical applications
Web-based database applications that require
increased security and fault tolerance

Guide to Oracle 10g 38

The Oracle 10g Client/Server
Oracle 10g
Latest release of Oracle Corporations relational
Client/server database
Server side
DBMS server process
Oracle Net
Utility that enables network communication
between client and server

Guide to Oracle 10g 39

Client/Server Architecture for
Oracle 10g DBMS

Guide to Oracle 10g 40

The Oracle 10g Client/Server
Database (continued)
Oracle Application Server
Used to create World Wide Web pages that allow
users to access Oracle databases
Oracle client products:
Oracle 10g Developer Suite
Enterprise Manager

Guide to Oracle 10g 41

The Database Cases

Fictional organizations:
Clearwater Traders
Northwoods University
Design principles:
Convert all tables to third normal form
Include primary key as foreign key in table on
many side of relationship
Specify data type for each column

Guide to Oracle 10g 42

The Clearwater Traders Sales Order
Clothing and sporting goods through mail-order
Wants to begin accepting orders using Web site
Required data consists of information for:
Customers : name, address, ph. No., username, passwd
Orders : date, payment method, order source (catalog description
or website), item no., sizes, colors, quantity
Items: description, photo, category (womens clothing, outdoor
gear), prices, quantity on hand

Guide to Oracle 10g 43

The Clearwater Traders Sales Order
Database (continued)

Guide to Oracle 10g 44

The Clearwater Traders Sales Order
Database (continued)
Tables (continued): :

Guide to Oracle 10g 45

The Clearwater Traders Sales Order
Database (continued)
The Orders table
O_ID surrogate key acts as primary
C_ID foreign key links it to Customer table
OS_ID foreign key links it to Order_Source table
Order_Line table represents individual inventory items in a customer
This info is used to create printed customer order invoice and
calculate sales revenues
Composite primary key (O_ID + INV_ID) an order might have
several different inventory items but will never have the same
inventory item listed more than once
O_ID, INV_ID, Color are all foreign keys
Guide to Oracle 10g 46
The Clearwater Traders Sales Order
Database (continued)
The Color table
Is a lookup table or pick list
Contains list of legal values for a column in another table
To prevent typographical errors when new records are added to
inventory table (case sensitive)
Shipment_Line table represents individual inventory items in a
Ship_ID is NOT primary because some shipments have multiple Inv_IDs
Inv_ID is Not primary because the same Inv_ID might be in several
Ship_ID + Inv_ID composite primary key
Ship_ID and Inv_ID are also foreign keys
Guide to Oracle 10g 47
Visual Representation of the
Clearwater Traders Database

Guide to Oracle 10g 48

The Northwoods University Student
Registration Database
Student registration system
Data items consist of information about:
Student Enrollment

Guide to Oracle 10g 49

The Northwoods University Student
Registration Database (continued)

Guide to Oracle 10g 50

Visual Representation of the
Northwoods University Database

Guide to Oracle 10g 51


Relational databases
Store data in tabular format
Create relationships that link related data using key
Primary key
Column that uniquely identifies specific record
Foreign key
Creates relationship between two tables

Guide to Oracle 10g 52

Summary (continued)

Entity-relationship (ER) model

Used to describe types of relationships between
Normalization process
Used to determine which fields belong in which
Database system consists of
Database applications
Guide to Oracle 10g 53
Summary (continued)

Client/server databases divide database into

Server process that runs on network server
User application processes that run on individual
client workstations
Oracle 10g is a client/server database

Guide to Oracle 10g 54