30
Managing Organizational Data

Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Embed Size (px)

Citation preview

Page 1: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Managing Organizational

Data

Page 2: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Data Management in the Past

AdmittingID = 8-digit #

ClinicID = Alphanumeric

LaboratoryID = 9-digit #

Methodist Hospital

What problems do you see here?

Page 3: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Problems with Flat Files

Redundancy Of Data Stored Of Programs

duplicate input, processing, outputmany programs doing the same thing on different

data• ex: every program that produces a listing has to

open a file, read the records and write out to paper Lack of Standardization

Data Namesdifferent names for same datasame name for different data

Data Formats Security

New Reports = New Programs

Page 4: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Database Mgt Systems (DBMS)

Database: Repository for data Mgt System:

Software that controls db Allows database to be ACCESSED,

MAINTAINED and PROTECTED DBMS: software + repository

Page 5: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

DBMS

Separates Data from How it is Used

DBMS Repository Software

Programsthat use DBMS

People usingPrograms

People usingDBMS directly

Page 6: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Features in a Typical DBMS

Ability to Maintain Database Create and ‘populate’ tables (see next 2 slides)

Add records (see data entry form slide)

Delete or Modify records (see query languages slide)

Ability to Access Data in Database Query (see simple query slide)

Reports (see report from query slide)

Programming in a Database Macros Application Programs

Ability to Fine-tune DBMS performance Ensure data integrity (see slide on integrity)

Page 7: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Tables in a Database

Primary Key = unique identifier

Page 8: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Table Structure (creates fields)

Page 9: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Add Records - Data Entry Screen

Page 10: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Simple Query

Query Setup

Execution of the query

Note: this is a ‘pseudotable’ -- it doesn’t take up space on disk

Could alsospecify howto sort records

Tell system what to filter out

Page 11: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Query Languages

SQL Select -- pull info from one or more tables

SELECT EMPID,FIRST,LAST FROM EMPLOYEE WHERE OVERTIME > 0 ORDER BY OVERTIME

Update Query change records in a table ex: raise prices, give raises

Delete Query Natural Query Language

Which shipments are overdue? Translated by DBMS into SQL

Page 12: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Report based on a table or a ‘psuedo’ table (from a query)

Page 13: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Typical TPS Database

Will have these types of tables Master tables

for entities of the organization like master files in flat file system

Transaction tables for relationships between entities like transaction files

Lookup tables connect a code to detailed info ex: Dept ‘AC’ = Accounting in Suite 404

And allow joining of tables when need info from multiple tables

Page 14: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Relationship Map

Arrows indicate table joining - records in each table are matched up using the key(s) in bold

Page 15: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Joining Tables in a Query

Join Creates a new ‘pseudotable’ from multiple existing

tables by… Matching up ID numbers

How it works All the tables must have one field in common The common must be an ID-type field You tell the DBMS to join these ID fields in the different

tables The DBMS will do the matching and create the

Pseudotable

Page 16: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Good database design

Goals are to… Minimize storage

By minimizing redundancy Maximize accessibility

By ensuring that tables can be joined Maximize readability

Naming conventions E-R Diagrams are a design tool

First capture reality in diagram Then translate reality to tables

Page 17: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Entity-Relationship Diagrams

Entities The things or events to be stored in database Each entity will get one or more tables

• Ex: Department table, Employee table Fields or attributes are sometimes also shown

Relationships Connections between entities)

• Ex: Department ‘has’ Employees

Department Employeeshas SSN,Name, Salary

DeptIDLocationSupervisor

Fields RelationshipEntity Entity Fields

Page 18: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Relationships between Entities

The type of relationship determines… The number of tables needed in DB

The next step is to determine what

type of relationships are there There are 3 types of relationships

One-to-One RelationshipEmployee Computer

One-to-Many RelationshipDepartment Employee

Many-to-Many RelationshipSupplier Product

Page 19: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

One To One Relationship

Need to add reference key to one of the tables pointing to the other

Employee and Computer tables Primary key of Employee table is EmpID

Computer table has EmpID too Reference field that points to Employee Table

EmpID First Last Dept

1 John Smith MK

2 Carol Doe AC

3 Barb Jones MK

Serial No Machine EmpID

333-44 Gateway 2000 2

333-45 Compac 3

JoinNote: Putting Serial No in Employee table would also work

Page 20: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Pseudotable (after join)

When query is executed, the DBMS… finds all the records in Computer table that have the same EMPID as a record in the Employee table “joins” the two records and puts them in pseudotable

Notice that EmpID #1 is missing Once joined can use info from either table

ex: create a computer listing w/ names

EmpID First Last Dept Machine Serial

2 Carol Doe AC Gateway2000

333-44

3 Barb Jones MK Compac 333-45

Page 21: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

One to Many Relationships

DPTID ADDR NAME

Department Table (“one” table)

MK Suite 1 MarketingAC Suite 2 Accounting

Employee Table (“many” table)

EMPID FIRST LAST DEPT

1 John Smith MK2 Carol Doe AC3 Barb Jones MK

Why can’t you put EmpID in the Department table?

Page 22: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

One to Many Join Result

New Pseudo Table

Notes: Redundant information in Pseudotable

DeptID, Suite #, Namebecause of one to many relationship

No redundancy in original Department Table Limited redundancy in original Employee Table (only Dept code) Can still use fields from either table for report

ex: Directory of employee names grouped by Department

1 John Smith MK Suite 1 Marketing2 Carol Doe AC Suite 2 Accounting

3 Barb Jones MK Suit 1 Marketing

EMPID FIRST LAST DPTID ADDR NAME

Page 23: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Original Relationship is many to many

Many to Many Relationship

Product Table Supplier Table

Product-Supplier Relationship Table

You need 3 tables,

Many to Many Relationship becomes two different

one to many relationships

SID Name City Status

PID SIDP1P1P2P3

S1S2S1S2

(Product 1 supplied by Supplier 1 & 2. Supplier 1 sells Product 1 & 2)

PID Name Price Qty

Page 24: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Basic Data Concepts

Concept File Term Db TermSmallest particle Character Character

Stored Facts Field Data Item, Attribute

Set of Facts aboutan item

Record Record

Set of records w/same format

File Table

Ways to link files Program Join command

Page 25: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Relationship-Table Guidelines

One-to-One Relationship Can put both entities in one table Or create two tables

one table must have a reference field that points to the other table

One-to-Many Relationship need two tables

a table for each entity, plus reference in the “many” table pointing to the “one” table

Many-to-Many Relationship need 3 tables

a table for each entity, plus a relationship table and links from each entity to its side of the

relationship table

Page 26: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

DBMS Generations

Early Dbs: Hierarchical, Network Relational (most prominant)

each entity is stored in a table connect entities only when need to

Object Oriented entities stored in objects (data + actions) used for multimedia, complex text

ex: images, engineering specifications

Hypermedia Chunks of information (text, multimedia) One chunk has links to other chunks

Page 27: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Distributed Databases

Originally: one mainframe w/ central db

With minis, PC, mainframes, etc. Distribute Db to different sites

local, departmental, regional, headquarters db

invisible to user

Page 28: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Database Architecture

Several layers of databases on Db servers Operational databases (TPS data)

goal: speed, accuracy Data Warehouse

snapshot of operational db + previous year’s data Data Marts

Analytical databases for specific functional areas

Based on the concept of Data Mining ‘there’s informative gold in them thar dbs!’

Page 29: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

DBMS and Database Integrity

Features May Vary but all vendors will have...

Data Validation

Concurrency and Locking Features

Password Management Features

Page 30: Managing Organizational Data. Data Management in the Past Admitting ID = 8-digit # Clinic ID = Alphanumeric Laboratory ID = 9-digit # Methodist Hospital

Publishing Info for DB BookTitle: Manager’s Guide to Database TechnologyAuthor: Michael BlahaPublisher: Prentice Hall ISBN: 0130304182