View
217
Download
1
Category
Tags:
Preview:
Citation preview
Managing Organizational
Data
Data Management in the Past
AdmittingID = 8-digit #
ClinicID = Alphanumeric
LaboratoryID = 9-digit #
Methodist Hospital
What problems do you see here?
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
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
DBMS
Separates Data from How it is Used
DBMS Repository Software
Programsthat use DBMS
People usingPrograms
People usingDBMS directly
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)
Tables in a Database
Primary Key = unique identifier
Table Structure (creates fields)
Add Records - Data Entry Screen
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
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
Report based on a table or a ‘psuedo’ table (from a query)
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
Relationship Map
Arrows indicate table joining - records in each table are matched up using the key(s) in bold
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
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
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
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
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
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
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?
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
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
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
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
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
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
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!’
DBMS and Database Integrity
Features May Vary but all vendors will have...
Data Validation
Concurrency and Locking Features
Password Management Features
Publishing Info for DB BookTitle: Manager’s Guide to Database TechnologyAuthor: Michael BlahaPublisher: Prentice Hall ISBN: 0130304182
Recommended