tuesday, february 1, 20001 management of information systems: 45-870 mini-3 spring 2000

28
Tuesday, February 1, 2000 1 Management of Information Systems: 45-870 Mini-3 Spring 2000

Upload: gianna-rigsby

Post on 16-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Tuesday, February 1, 2000 1

Management of Information Systems: 45-870

Mini-3Spring 2000

Tuesday, February 1, 2000 2

Agenda Announcements Technology Byte Presentations Designing and Creating Databases

(Cont’d) Brief Review of Database Design Principles Using MS Access 2000 to Create Relational

Databases Writing Queries for Relational Databases Using MS Access 2000 to Write Queries for

Relational Databases

Tuesday, February 1, 2000 3

Announcements Technology Byte Presentations

Today (2/1): Section A: DeathSpiral.Com, E-Sixpack Section B: Jeree’s Kids, Hot TaMaLes

Thursday (2/3): Section A: Digital Agents, Hyperlinks Section B: Alwin & the Chipmunks, Cash

Money Brothers IT Exercise I Graded/Returned

Comments

Tuesday, February 1, 2000 4

Announcements Schedule modifications

There will be NO handout on Internet, Intranets, Extranets

Today we will continue with Database topics We will discuss Chapter 6 on Thursday (2/3)

IT Exercise II due no later than midnight this Friday, 2/4/00 Submit one set of answers for your team You can email to me as an MS Word

attachment or submit as hard copy

Tuesday, February 1, 2000 5

Announcements Technology Byte Report

Due on no later than midnight this Friday, 2/4/00

Submit as a web page linked to your team’s home page that you had created in the first IT exercise

Tuesday, February 1, 2000 6

Technology Byte Presentations Section A:

DeathSpiral.Com E-Sixpack

Section B: Jeree’s Kids Hot TaMaLes

Tuesday, February 1, 2000 7

Creating Relational Databases:Brief Review What is a relational database Going from a “flat” file to a

relational database…..

Tuesday, February 1, 2000 8

A Traditional “Flat” File

Dept-Name Dept-Chair Dept-AddressDept-Phone Fac-ID Fac-Name Fac-Rank Course-NameCourse# Course-Cred Course-CapComp Sci Miller BT 250 4-3555 7345 Ludwigsohn Professor Intro 7001 3 45Comp Sci Miller BT 250 4-3555 7345 Ludwigsohn Professor Vbasic 7232 4 25Comp Sci Miller BT 250 4-3555 7345 Ludwigsohn Professor VBasic2 7233 4 25Comp Sci Miller BT 250 4-3555 6000 Smith AssistProf DataStructure 7400 4 90Comp Sci Miller BT 250 4-3555 6000 Smith AssistProf Java 7100 3 25English Russo HHH 540 4-5333 5290 Russo AssocProf Composition 5050 4 20English Russo HHH 540 4-5333 5290 Russo AssocProf Speech 5025 3 15

Tuesday, February 1, 2000 9

Relational DataBase

Dept Chair Address Phone

CompSci Miller BT 250 4-3555

English Russo HHH 540 4-5333

CourseName

Course# Credits Prof-ID EnrollCap

Intro 7001 3 7345 45

VBasic 7232 4 7345 25

VBasic2 7233 4 7345 25

Faculty Table

Dept Table

Course Table

Fac-ID Name Rank Dept

7345 Ludwigsohn Professor CompSci

5290 Russo AssocProf English

Tuesday, February 1, 2000 10

How to get from a flat file to a relational database? Identify Entities (Tables) Identify Attributes (Fields) Normalize Entities Identify Relationships between

Normalized Entities Identify Primary and Foreign Keys

Tuesday, February 1, 2000 11

EXAMPLE #1: Department DBEXAMPLE #1: Department DB

Data include: Department Name Department Chair Department Address Department Phone Faculty ID # Faculty Name Faculty Rank

Course Name Course # Course Credits Course Enrollment Capacity

Tuesday, February 1, 2000 12

Step#1: Pull out repeating groups (First Normal Form)

Step#1: Pull out repeating groups (First Normal Form)

FROM:Department (Dept-Name, Dept-Chair, Dept-Addr, Dept-Phone,

Fac-ID, Fac-Name, Fac-Rank, Course-Name,Course#, Course-Cred, Course-Cap)

TO:Department (Dept-Name, Dept-Chair, Dept-Addr, Dept-Phone)

Faculty-Course (Fac-ID, Fac-Name, Fac-Rank, Course-Name,Course#, Course-Cred, Course-Cap)

Tuesday, February 1, 2000 13

Step#2: Pull out facts about a portion of the key(Second Normal Form)

Step#2: Pull out facts about a portion of the key(Second Normal Form)

Doesn’t apply here?

Tuesday, February 1, 2000 14

Step#3: Pull out facts about a non-key attribute(Third Normal Form)

Step#3: Pull out facts about a non-key attribute(Third Normal Form)

FROM:Faculty-Course (Fac-ID, Fac-Name, Fac-Rank, Course-Name,

Course#, Course-Cred, Course-Cap)

TO:Faculty (Fac-ID, Fac-Name, Fac-Rank)

Course (Course-Name, Course#, Course-Cred, Course-Cap)

Tuesday, February 1, 2000 15

Normalized Relations for this Data

Department (Dept-Name, Dept-Chair, Dept-Addr, Dept-Phone)

Faculty (Fac-ID, Fac-Name, Fac-Rank, Fac-Dept)

Course (Course-Name, Course#, Course-Cred, Course-Cap,

Course-Fac)

Tuesday, February 1, 2000 16

From Normalized Relations to an Entity Relationship Diagram

each normalized relation becomes an entity

identifier of each normalized relation becomes the primary key

secondary identifier of each normalized relation becomes a foreign key

Characteristics of each normalized relation determine relationship between entities

Tuesday, February 1, 2000 17

Entity Relationship Diagram Example #1

Department

Course Faculty

(Fac-ID, Fac-Name, Fac-Rank, Fac-Dept)

(Dept-Name, Dept-Chair, Dept-Addr, Dept-Phone)

(Course#, Course-Name,Course-Cred,Course-Cap,Course-Fac)

Tuesday, February 1, 2000 18

From an ERD to a Database in MS Access 2000 Adding Tables, Relationships and Data

By hand Importing from spreadsheet

Important! Must use normalized tables, relationships

and data when creating the database in MS Access

Illustration for Example 1 See Data for IT Exercise II and MS

Access Tips 1

Tuesday, February 1, 2000 19

Retrieving Data from Databases Selecting Relations Joining Relations Projecting columns (fields) from

the joined relation Selecting rows (records) from the

joined relation

Tuesday, February 1, 2000 20

Retrieving Data from Databases (Cont’d) Deriving new attributes Indexing/sorting rows (records) Calculating totals Presenting data

Tuesday, February 1, 2000 21

Writing Queries in MS Access 2000 See MS Access Tips 2

Simple queries Grouping, summing & sorting fields Selecting data Calculated fields Displaying/not displaying fields Make vs. Select Table queries

Illustrative Examples

Tuesday, February 1, 2000 22

Designing Databases:Another Example Normalizing and creating an ERD

for the Sales Report Data

Tuesday, February 1, 2000 23

EXAMPLE #2: Sales Report DataEXAMPLE #2: Sales Report Data

Data includes: Sales Person # Sales Person Name Sales Area Customer Name Customer Number Warehouse Number Warehouse Location Sales Amount

Tuesday, February 1, 2000 24

Step#1: Pull out repeating groups (First Normal Form)

Step#1: Pull out repeating groups (First Normal Form)

FROM:SalesReport (SalesPerson#, SalesPerson-Name, Sales-Area,

Customer#, Customer-Name, Warehouse#,Warehouse-Location, Sales-Amount)

TO:SalesPerson (SalesPerson#, SalesPerson-Name, Sales-Area)

SalesPerson-Customer (SalesPerson#, Customer#, Customer-Name, Warehouse#, Warehouse-Location, Sales-Amount)

Tuesday, February 1, 2000 25

Step#2: Pull out facts about a portion of the key(Second Normal Form)

Step#2: Pull out facts about a portion of the key(Second Normal Form)

FROM:SalesPerson-Customer (SalesPerson#, Customer#,

Customer-Name, Warehouse#, Warehouse-Location, Sales-Amount)

TO:Sales (SalesPerson#, Customer#, Sales-Amount)

Customer-Warehouse (Customer#, Customer-Name, Warehouse#, Warehouse-Location)

Tuesday, February 1, 2000 26

Step#3: Pull out facts about a non-key attribute(Third Normal Form)

Step#3: Pull out facts about a non-key attribute(Third Normal Form)

FROM:Customer-Warehouse (Customer#, Customer-Name,

Warehouse#, Warehouse-Location)TO:Customer (Customer#, Customer-Name)

Warehouse (Warehouse#, Warehouse-Location)

Tuesday, February 1, 2000 27

Normalized Relations for this Data

Sales (SalesPerson#, Customer#, Sales-Amount)

SalesPerson (SalesPerson#, SalesPerson-Name, Sales-Area)

Customer (Customer#, Customer-Name, Warehouse#)

Warehouse (Warehouse#, Warehouse-Location)

Tuesday, February 1, 2000 28

Entity Relationship Diagram Example

SalesPerson

Customer

Warehouse

Sales

(SalesPerson#, Customer#, Sales-Amount)

(SalesPerson#, SalesPerson-Name, Sales-Area)

(Customer#, Customer-Name, Warehouse#)

(Warehouse#, Warehouse-Location)