36
Database Design and Implementation CIS 591 Dr. Stephen C. Hayne

Database Design and Implementation CIS 591 Dr. Stephen C. Hayne

Embed Size (px)

Citation preview

Database Design and Implementation

CIS 591

Dr. Stephen C. Hayne

Outline

Historical development Terms and concepts Objectives of database systems

Timely and Accurate Information

United Airlines (290,000 flight coupons per day and electronic ticketing):– Assemble information dynamically– Get multiple perspectives on the data to

decide how to handle discrepancies– Increase accuracy on revenue figures– Improve scheduling, fares and

marketing

Databases Today

Big business in software industry ($>10B/year in US alone)

Field is still young (<30 years) Rapidly changing environment DBs are now pervasive

Payroll File

Soc.Sec.# Name Hours Rate

000-00-0000 Barbie 40 10.00

123-45-6798 Ken 40 20.00

987-65-4321 Barney 20 5.00

FieldsPrimary key

A “logical” record

COBOL Record Description

01 EMPLOYEE RECORD

03 SS# PICTURE X(11)

03 NAME PICTURE A(20)

03 HOURS PICTURE 9(2)

03 RATE PICTURE 99V99

Compiling a Program

COBOL Program

COBOL Compiler

Executable Program

Base Salary Added

Soc.Sec.# Name Hours Rate Salary

000-00-0000 Barbie 40 10.00 1000

123-45-6798 Ken 40 20.00 2000

987-65-4321 Barney 20 5.00 1

What does this imply for the program?

It means that...

We must modify » the file itself» the COBOL program

Re-compile the program Re-comple any program using that file Y2K anyone?

In the beginning (1960’s)

Sue Programmer

Payroll Program

Payrollfiles

Joe Programmer

Benefits Program

Benefitsfiles

Maintenance

Sue Programmer

Payroll Program

Payrollfile (mod)

Joe Programmer

Benefits Program

Benefitsfile

Mod

Mod

Expense Report

Expensefile

And it goes on....

Sue Programmer

Payroll Program

Payrollfile

Joe Programmer

Benefits Program

Benefitsfile

Mod

Mod

Expense Report

Expensefile

Thelma

Louise

Expensefile

Data File Summary

Data is separated and isolated. Data is often duplicated. Application programs are dependent on

file formats. Files are often incompatible. Data often not represented in user's

format.

Data Independence Decouple data from programs

PayrollProgram

BenefitsProgram

DBMS

IntegratedDatabase

Database Management Systems

DBMS: The software package» SQL Server, Oracle, Informix, DB2,

Sybase, Access, etc. Treat data as an organizational asset Manage data independently of programs Provide better access Provide information for management

Data as an Organizational Asset

Record keeping Accounting Managing / Decision Making

» Strategy» Quality» Customer service» Data mining» Business Process Reengineering

Strategic

Tactical

Operational

Organization LevelBroadLong-TermUnstructuredExternally-OrientedVolatileUnpredictable

NarrowShort-TermStructuredInternally-OrientedStablePredictableFinance Production Marketing

Database Applicability

Definition of a Database

A database is a model of a model A database is a self-describing

collection of integrated records» data» meta-data» indexes» application meta-data

Database Terms Entity (instance)

» an individual “thing” about which data is stored– a student, a car, a computer, an employee

» represented in a record Attribute

» a characteristic of an entity– student name, color of a car, make of computer

» represented in a field Entity type or class

» a set of entities of the same kind– the students at ASU, the set of pickup trucks

» represented in a relation or table (file)

Payroll Relation (Table)

Soc.Sec.# Name Hours Rate

000-00-0000 Barbie 40 10.00

123-45-6798 Ken 40 20.00

987-65-4321 Barney 20 5.00

AttributesPrimary key

Tuple (row)

Controlling Redundancy - effort duplication, wasted storage, inconsistencies

Standardization Data Sharing - concurrency control, user views Multiple Interfaces - query language, program interface,

menus, natural language Data Relationships Integrity Constraints - data types/relationships Backup and Recovery Productivity

DBMS Objectives

Three Schema Architecture

ExternalView

ExternalView

Conceptual Schema

Internal Schema

DBMS Architecture

Logical Independence

Physical Independence

Logical Independence - ability to changeconceptual schema without alteringexternal schemas

Physical Independence - ability to change internal schema with altering conceptual (or external) schemas

Increased overhead due to mapping

Data Independence

External Level

User views» What each user or user group “sees”» Only the entities, attributes and

relationships relevant to each user» May have aliases for attributes

– Customer vs. Patron

» May have different output formats– Negative values in red or in parentheses

Conceptual Level

The “logical schema”» ALL the entities, attributes and relationships» The constraints on the data» Semantic information about the data» Security and integrity information

The Internal Level

The physical schema Storage space allocation for data and

indexes Record descriptions Data compression and data encryption

techniques

Objectives of Database Systems

Access Flexibility» Query languages (DML)

– SQL (sometimes pronounced sequel)– QBE

» Embedded languages– SQL– CODASYL DML

» Forms and Reports

Objectives of Database Systems (Cont’d)

Data Integrity» Correct» Consistent» Current» Critical for users!

Objectives of Database Systems (Cont’d)

Data Security» Prevent unauthorized access» Prevent accidental damage» Recover if damage occurs

Objectives of Database Systems (Cont’d)

Reduced Data Redundancy» Store each datum in only one place » Disk space» Update problems

– Time– Data Integrity

Objectives of Database Systems (Cont’d)

Data Sharing» only among appropriate users» Compared to paper

– Paper in one place at a time– Databases shared by many at the same time– Can redesign systems

» Politically difficult– Who “owns” the data?– Who sees the data?– Who updates the data?

Objectives of Database Systems (Cont’d)

Relationships» among entities» For example, customers and orders.

– Each customer is related to zero, one or more orders.– Each order is related to one customer

Customer Order

Objectives of Database Systems (Cont’d)

Standardization» Data dictionary» Standard codes (M=Male, F=Female)» Standard formats (Gender is one letter)» Standard definitions

– What is a proposal?– What is a full-time student?

Objectives of Database Systems (Cont’d)

Personnel productivity» Share data definitions and databases» Share code» Don’t reinvent the wheel

Some Disadvantages

Complex, large, expensive software Hardware and conversion costs Performance problems Complex application development

» Large systems» Organizational considerations

Summary

Data is an important resource. Databases seek several objectives. Databases must be well-designed. Databases must be well-managed. The database environment is complex.