Anda di halaman 1dari 67

File and Database

Management
Concepts, Terms, and Approaches
Unit Objectives
Elevate your understanding of DBMS
issues and goals.
Elevate recognition and understanding
of associated terms.
Elevate understanding of different
types of database software.
Elevate understanding of database
design issues, tools, and processes.

Did You Know..
~40% of all IS jobs are database related
Hardware and software sales
Hardware and software support
Data Administration &Management
Migration and integration
Data quality
Analytics
Big Data, Rich Customer Records
Click stream analysis
Proximity analysis
What Is A DBMS?
DBMS = Database Management System
Critical Software Class
Software that helps companies:
Efficiently capture and store data
Organize data
Retrieve data (for later use)
Share data
Safeguard data
Aggregate data (data warehouse)
The DBMS builds and maintains Org database
Where Does the Data Come From?
Database
TPS
POS
GL
Inv
Clickstream
Manual
Updates
External
Vendor/Partner
EDI
Purchased
What is Data? - Conceptually
The E/R model of data is prominent.

E/R = Entity / Relationship

Any data can be ABSTRACTED into a
collection of entities & relationships.

Renders DBMS software universal.
E/R Model Concept: Entity
Person
an employee
a customer
a prisoner

Place
shipping address
billing address
office number
Thing
screwdriver
checking account
VIN

Event
sale of item
register for course
pledge of money
E/R Model Terms:
Entity Vs. Entity Class
Parent is an entity class.
Eddie Yokum is a Parent (indiv ent).

Animals is an entity class.
Dogs is a sub-class of Animals.
Spot is a Dog, Spot is a Animal.

In most DBMS, entity class is a ?
In most DBMS, individual entity is a ?

E/R Model Concept: Relationship
An association or link between:

Two or more entities.

Nancy is mother of Steve.
Clinton is president of U.S.

Two entity classes.

Cops chase robbers.

In database land, usually talking about
association between two entity classes
Types of Relationships
One To One (1:1)

The relationship between two entities is unique.

Examples:
117-646-0410 is SSNUM of Steve
George Washington is the first president of U.S.
14420 is zip code of Brockport Post Office.

What is the broader class structure for above
examples?
Types of Relationships
One To Many (1:M)

(potentially) several entities in one entity class are
related to a single entity (from another class).

Examples:
Breslawski (advisors) is assigned Advisees
Nancy (birth mothers) is mother of Children.
Types of Relationships
Many To Many (M:N)

(potentially) several entities in one entity class are
related to several entities (from another class).

Examples:
Students register for Courses
Part-Time Employees work for Employers.
Parts are ordered from Vendors.
Who Cares?
Functionality dictates database design!
One to one implies a single table
One to many 2 tables, foreign key required
Many to many: requires a 3rd (intersection) table
Students Faculty
Event
(date, grade, room)
M to M
E/R Summary: Data is Either
an Entity or a Relationship
Entities:
Person
Place
Thing
Event
Relationship
An association between
two entity classes
1:1 (one to one)
1:M (one to many)
M:N (many to many)
All E/R databases require your to represent
each item of business data as either an
entity or relationship!
New Subject: Data Hierarchy
Bit Binary Integer 0/1
Character - a letter, digit, or special char
ASCII Character: 7 Bit character code
Each character requires 7 bits
Each combination of 7 bits = a different character
1100001 = a
1100101 = g
1000001 = A
1011010 = Z
1000000 = @
Extended ASCII 8 bit code (PC, Unix)
EBCDIC 8 bit IBM code (IBM VM, VSE, OS/400)

A 7 bit character code has 2
7
= 128 characters
A-Z (26), a-z (26), 0-9 (10)
Special characters (!@#$%&*, etc.)
Data Hierarchy (cont.)
Bit
Character (8 bits)
Field: collection of chars name, price
Record: Collection of related fields (customer rec)
File: Collection of related records (customer file)
Directory (folder): Collection related files (mydocs)
Partition (optional): Collection related directories
Volume (disk): Contents of all partitions
Data wharehouse, Datamart

Related terms: file lock, record lock, sub-directory


New Subject:
Implementing the E/R Model
What program(s) control the data?
How will data be retrieved by users.
Traditional Approach
Each Application has its data in its own file.
Application
Program
(e.g. Inventory)
Custom
File
Reports
Traditional Data Management
(Program Centric Approach)
Each program manages its own data
Files structures determined by application programmer.
Data Structure may not be compatible across applications.
FIRST LAST MI ST ZIP
xxxxx-xxxx
FNAME LNAME MNAME ST ZCODE
xxxxx
LASTNAME FIRSTNAME SSNUM STATE
File 1
File 2
File 3
Drawbacks
Redundancy
Lack of integrity: missed updates
Cant share data, enter same data several x
Program dependence

Benefits
File structure optimal for application.
Traditional Approach
DBMS (data centric) Approach
Applications share central data resource
Central
Data
Base
DBMS
Application 1
Application 2
Application 3
Ad Hoc
Queries
BI Apps
DW
DM1 DM2
Module n
(DW)
Central
Data
Base
DBMS Approach - ERP Variant
Applications share central data resource
DBMS
Module 4
(HR)
Ad Hoc
Queries
Module 3
(SCM)
Module 2
(CRM)
Module 1
(ACCT)
E
R
P

S
O
F
T
W
A
R
E




DBMS Approach Requires More
Planning and Management $$$$
(necessary overhead)
Schema - File(s) that describe:
For Each Item of Data:
Label (e.g. fname, firstname, etc.)
Aliases
Characteristics (size, type of field)
Read/update privileges
Location (file) in database
Validation rules
Range, Domain
Central
Data
Base
Schema
DBMS Approach Also Requires
Sub-schema - File(s) that describe,
for each data item and application:
Data that can be accessed
Data that can be changed

Central
Data Base
(Ap data)
Sub-schema
Sub-schema
Sub-schema
Schema
DBMS
Application 1
Application 2
Application 3
Ad Hoc
Queries
Check Here 1st
Before get / update
DBMS Approach Requires
Sub-schema - File(s) that describes,
for each entity and application:
Data that can be accessed
Data that can be changed

Sub-schema support Views
What does a secretary see?
What does the production manager see?
What does the HR manager see?
Central
Data
Base
Sub-schema
Sub-schema
Sub-schema
Schema
DBMS Approach Requires
Data Dictionary - A(n electronic)
Document that details the
Schema and sub-schema:






Programmers conform to data dictionary.

Central
Data
Base
Sub-schema
Schema
Data
Dictionary
DBMS Approach Requires
Database Administrator (DBA)
high level person or staff
in charge of database, including:
in charge of schema,
sub-schema and views
maintaining data dictionary
disaster plans
physical design
Data
Dictionary
Jobs on
Monster?
DBMS Goals
Reduce Redundancy
Increase Accuracy, Completeness
Increase Legal Access
Prevent Intentional / Unintentional / Unauthorized
Modification, Disclosure
Promote Systematic Backup, Maintenance
Standardize Access Protocols, Procedures
Assign Responsibility for Data Resource
To Utilize DMBS Software
Must First
Describe
Entities to Be
Recorded in
Database
Describing Entities
Entities Are Described by Their Attributes
(also called fields or sub-fields)

Ex: Lname, Fname, Height, Weight, SSNum
Attributes describe an entity

Entities Also Described by Their
Relationships to Other Entities.
Are Students related to Faculty?
Are Students related to Courses?
Are Students related to Phys Plant Vendors?

Describing Entities (continued)
Label
Aliases
Caption
Data Type
Character / text
Number
Currency
Date
Boolean (y/n)
Memo
Picture
Link




Field Size
Precision
Mask
Default
Range
Domain
Permissions
View
Change
Delete
Create
Establish Characteristics of Each Attribute
DDL
Describing Entities
Define Record Structure
Record: a collection of attributes.
One record per individual (entity).
Collection of records = File, Entity Class
Name SSNUM Address State Zip
Describing Entities
Define Key Sturcture: A Key is a field
or combination of fields that uniquely identifies
a record.

Primary, Secondary
Name SSNUM Address State Zip
SSNUM
Types of Keys
Primary Key (required), Secondary Key (optional)
Candidate Key
Concatenated Key (see below)
Foreign Key (see next page)
Foreign Key (one to many relationship)
A field (e.g. VNum) that acts as the key in the record
structure for Entity B (Vendor) that also appears in the
record structure for Entity A (Parts). However, while the
field (VNum) is part of Entity A, it is not the Key of Entity A.

PNum Pname Price VNum
Parts Table
VNum Vname Vaddress
Vendor Table
Key in This
Table
Foreign Key
in This Table
To Utilize DMBS Software
Not
So
Fast!
Entities Also Described by Their
Relationships to Other Entities.
Are Students related to Faculty?
Are Students related to Courses?
Are Students related to Phys Plant Vendors?
Need to Establish Relationships
Link Key in Table A w/ Foreign Key in Table B
Drag from the one to the many (A to B)
Types of E/R Data Bases: Relational
Has become most popular form of E/R database.

All PC DBMS are relational.
MySQL, Access, Paradox, FilemakerPro, Lotus Approach

Most Enterprise DBMS are relational
DB2, Oracle, MySQL Enterprise, SQL Server, Sybase

Name relational comes from application of
relational algebra constructs to sets of data.
Relational E/R Model
Basic relationships take the form of two-
dimensional tables.

E.g.
Mother_of_table
Mother Offspring
Nancy steven
Nancy Donna
Susan Courtney
Jodi Alex
Relational E/R Model
Basic relationships take the form of two
dimensional tables.

E.g.
Mother_of_table
Mother Offspring
Nancy steven
Nancy Donna
Susan Courtney
Jodi Alex
Relationship
Entity Entity
Relational E/R Model
More complex relationships can be built by linking
tables.

Customer Salesrep
Works
With
Fills
Out
Order
0:M 1:1 1:1 0:M
Relational E/R Model
Advantages:
Conceptually appealing
Tables (relationships) are just files.
Relationships can be added by adding new files
to database.
Enterprise packages now available (e.g. DB2)
Can model 1:1, 1:M, M:N

Disadvantages:
Slow!!!! (but getting faster from hardware)
Relational Database Objects
Table (input/storage/output)
Form (input)
Report (output)
Query (selection and aggregation)
DAP (web access)

Queries are the star of the show!
Other DBMS Terms: Query
What Rows?
(e.g.What Cities)
Query
Queries specify What data will be viewed
Table
Other DBMS Terms: Query
Queries specify What data will be viewed
What Columns?
(e.g.What Employee Characteristics)
Query
Table
Other DBMS Terms: Query
What Manipulations?
(e.g. Price * Quantity = Amount of Sale)
Query
New Info: Not in
Original Table!
Table
Other DBMS Terms: Query
Aggregation: Level of Detail?
(e.g.Total Sales By City)
Query
Totals (Or Avgs, Maxs, Mins)
Other DBMS Terms: Query
From What Tables?
(e.g.Customer Name w/ Salesperson Name)
Query
Customer Table
Salesperson Table
Other DBMS Terms: QBE vs SQL
Both QBE and SQL are query languages:
Used to create database queries
QBE: Query By Example
Non-programmers approach
Fill in a predefined grid to describe query

SQL: Structured Query Language
SQL Runs on most database packages
More robust than QBE
Resembles a programming language

SELECT prod_name, prod_price
FROM tblProducts
WHERE prod_price <= 8.99
ORDER BY prod_price DESC;
SELECT COUNT(*) AS num_items,
MIN(prod_price) AS price_min
MAX(prod_price) AS price_max
AVG(prod_price) AS price_avg
FROM tblProducts;
Queries In Access
Can use QBE or SQL
Types:
Select (rows and/or columns)
Cross Tab
Aggregate
Append
Make Table
Update
Delete
Union/Join

Some Other DBMS Terms
Normalization
A Process
Leads to A Correctly Designed Database
Answers following questions
How many tables
Contents of each table
Keys, foreign keys of each table
Relationships between tables
Prevents update, deletion, and insertion anomalies

E/R diagram (data model)
Picture paints a thousand words concept
Used by analyst to communicate understanding
of database requirements and business rules
Customer Salesrep
Works
With
Fills
Out
Order
Includes
Products
Produces
Process
Uses
Machines Labor Materials
Provides
Supplier
Contain
Hazardous
Chemicals
Supervisor
Trains
Runs
0:M 1:1 1:1 0:M
1:M
0:M
1:M 1:1
0:M
1:M
1:M
1:M
1:
1
1:M
1:
1
1:M 1:M
0:M
0:M
1:M
EXAMPLE: E/R Diagram
Sometimes E/R Diagrams
Show Attributes Too
Attribute symbol =

Multi-valued Attribute =
Customer
Street
City
State
Phone
Some Other DBMS Concepts
Referential Integrity
1:1, 1:M relationships
Can only add data if corresponding record
exists in other file
Ex: (cant sell a part that doesnt exist)

Cascade Delete
Cascade Update
Other DBMS Concepts:
Sort vs Index
SORT
produces entire new file
physically rearranges entire record
slow to sort, efficient to process
good for static databases

INDEX
produces small file of key / address pairs
rearranges only the key / address pair
quick to order, slower to process
good for dynamic databases.
Other Classifications of
DBMS Software
Enterprise
Many users
Concurrent Access
High Security
Robust Processing
Desktop
1-10 Users
Low Security
Smaller Data Sets
Cross-platform Support

All DBMS software is E/R oriented.

However, there are three common E/R implementations :
- Hierarchical
- Network
- Relational (most databases)

Cloud
Emerging Format
Small/Medium
Integration Issues
Hierarchical E/R Model
Argues that relationships can be represented
as hierarchies.
A Data Hierarchy
VP 1A VP1B VP1C
President 1
Subsidiary 1
VP 2A VP2B
President 2
Subsidiary 2
VP3A VP3B
President 3
Subsidiary 3
Conglomerate Company
Hierarchical E/R Model
Nodes are Entities, Branches Are Relationships
A Data Hierarchy
VP 1A VP1B VP1C
President 1
Subsidiary 1
VP 2A VP2B
President 2
Subsidiary 2
VP3A VP3B
President 3
Subsidiary 3
Conglomerate Company
Rel = Owns
Rel = Run By
Rel =
Over Sees
Entities
Hierarchical DBMS Software
e.g. TOTAL (Cimcon - Enterprise)

Disadvantages:
Assumes mostly 1:1, 1:M relationships
People dont naturally organize data into
hierarchies (next slide)
Must specify ALL relationships a priori

Advantage: Fast, Fast, Fast!
How would you organize this list?
Sue, Peter, Abe, Zed, Kim, Betty, Molly
How would you organize this list?
Probably like this:

Abe, Betty, Kim, Molly, Peter, Sue, Zed

Not like this:




Where would you put Tim?
Molly
Sue
Zed Peter
Betty
Kim Abe
Summary: Hierarchical DBMS
Use when speed is paramount.

Use when database relations are established, static.

Use when relationships mostly 1:1, 1:M

Use when data is in a natural hierarchy or data can be
structured as a hierarchy.
Network E/R Model
Similar to hierarchical, but can model (easily)
M:M relationships.

Use graph (plex) instead of a tree.

Example: Students enroll in Classes
BUS317 ECN204 MTH245 ENG304
BOB SUE BARB DOUG
Network E/R Model
Advantages:
Faster than relational model (but slower than hierarchy)
Easy to represent M:M relationships.

Disadvantages:
Same problem of abstracting common business data.
Somewhat slower than hierarchical.
Relationships even more difficult to alter;
must be specified a priori.

Sometimes called DBTG model.
Things Your Should Know
What is an entity
What is a relationship
What is the E/R model?
What are 1:1, 1:N, 1:M relationships
What is a hierarchical database?
Advantages/Disadvantages/When Used
What is a network database?
Advantages/Disadvantages/When Used
What is a relational database?
Advantages/Disadvantages/When Used

Things Your Should Know
What are the goals of DBMS?
What is a schema, subschema, view?
What is a data dictionary?
What is a DBA? Why required?
Diff between Sort, Index
Diff between QBE and SQL
Key, Candidate Key, Concatenated Key,
Foreign Key
What is referential integrity?
What is cascade update?
What is cascade delete?

Things Your Should Know
What is an E/R diagram? Used Why?
In an E/R diagram,
Where are the Entities?
Relationships?
Attributes?
Cardinalities?
Data Definition Terms: caption, alias, mask,
range, domain, default value.
Sort vs Index

Anda mungkin juga menyukai