Database Design: Conceptual Model and ER...

62
2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model and ER Diagramming Ray R. Larson University of California, Berkeley School of Information IS 257: Database Management

Transcript of Database Design: Conceptual Model and ER...

Page 1: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 1

IS 257 – Fall 2015

Database Design: Conceptual Model and ER Diagramming

Ray R. Larson University of California, Berkeley

School of Information IS 257: Database Management

Page 2: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 2

IS 257 – Fall 2015

Announcements

•  Accounts and MySQL access •  Assignment 1 on web site (more at end of

class)

Page 3: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 3

IS 257 – Fall 2015

Lecture Outline

•  Review –  Information Systems Planning

•  Information Systems Architecture •  Information Engineering

– Database Design •  ER Diagrams •  Developing the Conceptual Model for the

Diveshop Database

Page 4: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 4

IS 257 – Fall 2015

Lecture Outline

•  Review –  Information Systems Planning

•  Information Systems Architecture •  Information Engineering

– Database Design •  ER Diagrams •  Developing the Conceptual Model for the

Diveshop Database

Page 5: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 5

IS 257 – Fall 2015

Information Systems Architecture

•  An ISA is a “conceptual blueprint or plan that expresses the desired future structure for information systems in an organization”

•  It provides a “context within which managers throughout the organization can make consistent decisions concerning their information systems” –  Quotes from McFadden (Modern Database Management, 4th edition),

Ch. 3

Page 6: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 6

IS 257 – Fall 2015

Information Systems Architecture

•  Benefits of ISA: –  “Provides a basis for strategic planning of IS –  Provides a basis for communicating with top

management and a context for budget decisions concerning IS

–  Provides a unifying concept for the various stakeholders in information systems.

–  Communicates the overall direction for information technology and a context for decisions in this area

–  Helps achieve information integration when systems are distributed (increasing important in a global economy)

–  Provides a basis for evaluating technology options (for example, downsizing and distributed processing)”

•  Read Chapter 2 in Hoffer…

Page 7: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 7

IS 257 – Fall 2015

Information Systems Architecture

•  Zachman ISA Framework components – Data

•  The “what” of the information system – Process

•  The “how” of the information system – Network

•  The “where” of the information system – People

•  Who performs processes and are the source and receiver of data and information.

– Events and Points in time •  When processes are performed

– Reasons •  For events and rules that govern processing

Page 8: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 8

IS 257 – Fall 2015

Zachman Framework

Page 9: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 9

IS 257 – Fall 2015

Information Engineering

•  A formal methodology that is used to create and maintain information systems

•  Starts with the Business Model and works in a Top-Down fashion to build supporting data models and process models for that business model

Page 10: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 10

IS 257 – Fall 2015

Information Engineering

Planning

Design

Analysis

Implementation

1. Identify Strategic Planning Factors a. Goals b. Critical Success Factors c. Problem Areas 2. Identify Corporate Planning Objects a. Org. Units b. Locations c. Business Functions d. Entity types 3. Develop Enterprise Model a. Function decomposition b. Entity-Relationship Diagram c. Planning Matrices

1. Develop Conceptual Model (detailed E-R Diagram) 2. Develop Process Models (data flow diagrams)

1. Design Databases (normalized relations) 2. Design Processes a. Action Diagrams b. User Interfaces: menus, screens, reports

1. Build database definitions (tables, indexes, etc.) 2. Generate Applications (program code, control blocks, etc.)

Page 11: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 11

IS 257 – Fall 2015

Focus

•  In this course we will focus on the design aspects for databases

•  We will NOT focus on interaction design or interface design (That is covered in other courses)

Page 12: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 12

IS 257 – Fall 2015

Database Design Process

Conceptual Model

Logical Model

External Model

Conceptual requirements

Conceptual requirements

Conceptual requirements

Conceptual requirements

Application 1

Application 1

Application 2 Application 3 Application 4

Application 2

Application 3

Application 4

External Model

External Model

External Model

Internal Model

Page 13: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 13

IS 257 – Fall 2015

Database Design Process

•  Conceptual Model – Merge the collective needs of all applications – Determine what Entities are being used

•  Some object about which information is to maintained

– What are the Attributes of those entities? •  Properties or characteristics of the entity •  What attributes uniquely identify the entity

– What are the Relationships between entities •  How the entities interact with each other?

Page 14: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 14

IS 257 – Fall 2015

Entity

•  An Entity is an object in the real world (or even imaginary worlds) about which we want or need to maintain information – Persons (e.g.: customers in a business,

employees, authors) – Things (e.g.: purchase orders, meetings,

parts, companies)

Employee

Page 15: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 15

IS 257 – Fall 2015

Attributes

•  Attributes are the significant properties or characteristics of an entity that help identify it and provide the information needed to interact with it or use it. (This is the Metadata for the entities.)

Employee

Last

Middle

First

Name SSN

Age

Birthdate

Projects

Page 16: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 16

IS 257 – Fall 2015

Relationships

•  Relationships are the associations between entities. They can involve one or more entities and belong to particular relationship types

Page 17: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 17

IS 257 – Fall 2015

Relationships

Class Attends Student

Part Supplies project parts Supplier

Project

Page 18: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 18

IS 257 – Fall 2015

Types of Relationships

•  Concerned only with cardinality of relationship

Truck Assigned Employee

Project Assigned Employee

Project Assigned Employee

1 1

n

n

1

m

Chen ER notation

Page 19: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 19

IS 257 – Fall 2015

Other Notations

Truck Assigned Employee

Project Assigned Employee

Project Assigned Employee

“Crow’s Foot”

Page 20: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 20

IS 257 – Fall 2015

Many to Many Relationships

Employee

Project Is Assigned

Project Assignment

Assigned

SSN

Proj#

SSN

Proj# Hours

Page 21: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 21

Note on drawing diagrams

•  You will be asked to draw ER (or UML) diagrams for your personal database

•  I prefer diagrams drawn with a drawing tool or DB Design tool

•  There are loads of DB Design tools –  See, e.g., http://www.databaseanswers.org/

modelling_tools.htm •  One that integrates well with MySQL is

MySQLWorkBench –  http://www.mysql.com/products/workbench/

IS 257 – Fall 2015

Page 22: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 22

IS 257 – Fall 2015

Lecture Outline

•  Review –  Information Systems Planning

•  Information Systems Architecture •  Information Engineering

– Database Design – ER Diagrams

•  Developing the Conceptual Model for the Diveshop Database

Page 23: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 23

IS 257 – Fall 2015

Developing a Conceptual Model

•  Overall view of the database that integrates all the needed information discovered during the requirements analysis.

•  Elements of the Conceptual Model are represented by diagrams, Entity-Relationship or ER Diagrams, that show the meanings and relationships of those elements independent of any particular database systems or implementation details.

•  Can also be represented using other modeling tools (such as UML)

Page 24: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 24

IS 257 – Fall 2015

Developing a Conceptual Model

•  Building the Conceptual Model for the Diveshop database

Page 25: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 25

IS 257 – Fall 2015

Developing a Conceptual Model

•  We will look at a small business -- a diveshop that offers scuba diving adventure vacations

•  Assume that we have already done interviews with the business and found out the following information about the forms used and types of information kept in files and used for business operations...

Page 26: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 26

IS 257 – Fall 2015

Primary Business Operations

•  The shop takes orders from customers for dive vacations.

•  It ships information about the dive vacation to the customers.

•  It rents diving equipment for the divers going on the trips (these may include additional people other than the customer)

•  It bills the customer for the vacation and for equipment rental or sales.

Page 27: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 27

IS 257 – Fall 2015

Business Operations (cont.)

•  It arranges sub-trips to particular dive sites at the primary location – NOTE: This needs expanding – e.g., charter

boats, divemasters, local dive companies •  It provides information about the features

of various sites to help customers choose their destinations. – Features include sea life found at the location

and shipwrecks

Page 28: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 28

IS 257 – Fall 2015

Business Operations (cont.)

•  Each dive order (or sale or trip) is on an invoice to one customer. –  Invoices contain:

•  Line items for each type of equipment ordered, •  Total amount due for the invoice, •  Customer information:

–  Name, address, phone, credit card info. •  Note: could be expanded with particular charter dates and

time, dive boats, etc.

•  Information must be kept on inventory of dive equipment.

•  There are multiple types of dive equipment: –  The prices charged for sale or rental are maintained

Page 29: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 29

IS 257 – Fall 2015

Business Operations (cont.)

•  Destination information includes: –  Name of the destination –  information about the location (accomodations, night

life, travel cost, average temperatures for different times of the year

•  Destinations have associated dive sites •  Dive Sites have associated features

–  Difficulty rating, depth, etc. –  Sea life –  Shipwrecks (as sites or at sites) –  Note: could be expanded to include the boats, etc.

that go to specific sites

Page 30: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 30

IS 257 – Fall 2015

Business Operations (cont.)

•  One record is kept for each order by a customer and will include the method of payment, total price, and location information. (I.e. Customers may have multiple orders)

•  The company needs to know how an order is to be shipped.

•  The shop has to keep track of what equipment is on-hand and when replacements or additional equipment is needed

Page 31: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 31

IS 257 – Fall 2015

Entities

•  Customer •  Dive Order •  Line item •  Shipping information •  Dive Equipment/

Stock/Inventory •  Dive Locations

•  Dive Sites •  Sea Life •  Shipwrecks

Page 32: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 32

IS 257 – Fall 2015

Diveshop Entities: DIVECUST

Name

Customer no

Street

State/Prov City ZIP/Postal Code

Country

First Contact

Phone DiveCust

Page 33: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 33

IS 257 – Fall 2015

Diveshop Entities: DIVEORDS

Customer No

Order no

Sale Date

Ship Via

Destination CCExpDate

CCNumber

Payment Method DiveOrds

No of People

Vacation Cost

Return Date

Depart Date

Page 34: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 34

IS 257 – Fall 2015

Diveshop Entities: DIVEITEM

Item no

Order no

Rental/ Sale

Qty

Line Note DiveItem

Page 35: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 35

IS 257 – Fall 2015

Diveshop Entities: SHIPVIA

Ship Via

Ship Cost

ShipVia

Page 36: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 36

IS 257 – Fall 2015

Diveshop Entities: DIVESTOK

Description

Item No

Equipment Class

Reorder Point On Hand Cost

Sale Price

DiveStok Rental Price

Page 37: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 37

IS 257 – Fall 2015

Diveshop Entities: DEST

Destination name

Destination no

Avg Temp (F)

Spring Temp (F) Avg

Temp (C) Summer Temp (C)

Summer Temp (F)

Travel Cost

Winter Temp (C)

Fall Temp (F)

Fall Temp (C) Dest

Winter Temp (F)

Accommodations

Body of Water

Night Life

Spring Temp (C)

Page 38: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 38

IS 257 – Fall 2015

Diveshop Entities: SITES

Destination no

Site no

Site Name

Site Notes

Site Highlight

Distance From Town (M)

Distance From Town (Km)

Skill Level

Visibility(ft)

Depth (m)

Depth (ft) Sites

Visibility (m) Current

Page 39: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 39

IS 257 – Fall 2015

Diveshop Entities: BIOSITE

Species No

Site No

BioSite

Page 40: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 40

IS 257 – Fall 2015

Diveshop Entities: BIOLIFE

Category

Species no

Common Name

Length (cm)

Species Name

Length (in)

Notes external

Graphic external BioLife

Page 41: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 41

IS 257 – Fall 2015

Diveshop Entities: SHIPWRCK

Site no

Ship Name

Category

Interest Type Tonnage

Length (ft)

Beam (m)

Beam (ft)

Length (m) Shipwrck

Cause

Comments external

Date Sunk

Passengers/ Crew

Graphic external

Survivors

Condition

Page 42: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 42

IS 257 – Fall 2015

Functional areas

•  Ordering •  Inventory •  Supplies •  Shipping •  Billing •  Location/Site Selection

– We will concentrate on Ordering and Location/Site Selection (these are joined tasks)

Page 43: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 43

IS 257 – Fall 2015

Ordering

Orders (DIVORDS)

Customer (DIVECUST)

Customers place Orders Each Order needs Customer information

Page 44: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 44

IS 257 – Fall 2015

Ordering

DiveOrds Orders DiveCust

Customer No ship

ShipVia

Order No

Ship Via

DiveItem Repeating attribute

Customer No

Page 45: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 45

IS 257 – Fall 2015

Ordering Normalization

DiveCust Orders

Customer No

DiveOrds

Ship

ShipVia

Order No

Ship Via

DiveItem Contains

Item No

Qty Order No

Customer No Rental/sale

Page 46: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 46

IS 257 – Fall 2015

Details of DiveItem

DiveStok Supplies Supplier

Company# Has

DiveItem

Item No

Item No

On Hand

Sale Price

Order No

m n

We’re ignoring this part...

Page 47: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 47

IS 257 – Fall 2015

Ordering: Full ER

Customer No

ShipVia

Dest ShipVia

DiveStok

DiveItem

DiveOrds

DiveCust

Customer No

ShipVia

Order No

Order No

Item No

Item No

Destination Name

Destination

Destination no 1

1

1

1

1 n

n

n

n

n

Page 48: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 48

IS 257 – Fall 2015

Location/Site Selection

Dest Going to? DiveOrds

Destination No

Destination Name Destination

Page 49: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 49

IS 257 – Fall 2015

Destination/ Sites

Dest

Sites

DiveOrds

Customer No

Order No

Destination Name

Destination Site No

Destination no

Destination no

1

1

n

n

Page 50: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 50

IS 257 – Fall 2015

Sites and Sea Life 1

BioLife

Sites

Site No Destination no

Multiple occurrences of sea life...

Page 51: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 51

IS 257 – Fall 2015

Diveshop ER diagram: BioSite

Species No

Site No

BioSite

Page 52: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 52

IS 257 – Fall 2015

Sites and Sea Life 2

Sites

BioSite

BioLife Species No

Site No

Site No

Destination no

Species No

1

1

n

n

Page 53: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 53

IS 257 – Fall 2015

Sites and Shipwrecks

Sites

ShipWrck

Site No Destination no

Site No

1/n 1

Page 54: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 54

IS 257 – Fall 2015

DiveShop ER Diagram Customer

No

ShipVia

Dest

Sites

BioSite

ShipVia

ShipWrck

BioLife DiveStok

DiveItem

DiveOrds

DiveCust

Customer No

ShipVia

Order No

Order No

Item No

Item No

Destination Name

Destination

Species No

Site No

Destination no

Site No

Destination no

Species No

Site No

1

1

1

1

1

1

1/n

1

1 n

n

n

n

n

n

n

n

1

Page 55: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 55

IS 257 – Fall 2015

What must be calculated?

•  Total price for equipment rental? •  Total price for equipment sale? •  Total price of an order?

– Vacation price – Equipment (rental or sale) – Shipping

Page 56: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 56

IS 257 – Fall 2015

What is Missing??

•  Not really an “enterprise-wide” database –  No personnel…

•  Sales people •  Dive masters •  Boat captains and crew •  payroll

–  No Local arrangements… •  Dive Boats

–  Charter bookings? •  Hotels?

–  Suppliers/Wholesalers for dive equipment •  Orders for new/replacement equipment

–  No history (only current or last order)

Page 57: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 57

IS 257 – Fall 2015

Diveshop database

•  We will take a look at the the MySQL version of the DiveShop database using phpMyAdmin

Page 58: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 58

IS 257 – Fall 2015

MySQL version of Diveshop

•  MySQL version of the database is available for download through the class web site

•  phpMyAdmin is a web-based interface for MySQL databases providing simple access and modification functions – Not really a full DB environment, but has

many useful features

Page 59: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 59

IS 257 – Fall 2015

phpMyAdmin

•  phpMyAdmin has been set up for iSchool MySQL database accounts

•  It can be accessed at https://groups.ischool.berkeley.edu/pma/ – Need to have I School login/pw and MySQL

login and pw •  Quick Demo…

Page 60: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 60

IS 257 – Fall 2015

Assignment 1 (also online)

•  How many tons was the sunken ship Delaware? •  What is customer Karen Ng’s address? •  At what destinations and sites might you find a

Spotted Eagle Ray? •  Where (what destination) is the site Palancar

Reef? •  What sites might Lorraine Vega dive on her trip? •  Keith Lucas wants to see a shipwreck on his trip.

Is he going to the right place? •  What equipment is Richard Denning getting? •  What is the cost of the equipment rental for

Louis Jazdzewski

Page 61: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 61

IS 257 – Fall 2015

Assignment 1: cont.

•  The Database is available on the course web site

•  Download your own copy and install from phpMyAdmin (demo)

•  For each of the questions create a query in phpMyAdmin (more on this later)

•  Create a document (Word, etc.) containing –  The query being answered –  The results of your query cut and pasted from

phpMyAdmin •  Due date Sept. 17

Page 62: Database Design: Conceptual Model and ER Diagrammingcourses.ischool.berkeley.edu/i257/s17/Lectures/... · 2015-09-03 - SLIDE 1 IS 257 – Fall 2015 Database Design: Conceptual Model

2015-09-03 - SLIDE 62

IS 257 – Fall 2015

Next Week

•  Tuesday: – Workshop on SQL – Workshop on Personal/Group DBs