8/28/97information organization and retrieval database design university of california, berkeley...
Post on 22-Dec-2015
215 views
TRANSCRIPT
![Page 1: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/1.jpg)
8/28/97 Information Organization and Retrieval
Database Design
University of California, Berkeley
School of Information Management and Systems
SIMS 202: Information Organization and Retrieval
![Page 2: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/2.jpg)
8/28/97 Information Organization and Retrieval
Review
• Database Data Models
• Database Design Process
• Basics of ER Diagrams
![Page 3: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/3.jpg)
8/28/97 Information Organization and Retrieval
Database Data Models
• Hierarchical Model– Similar to data structures in programming
languages.Books
(id, title)
Publisher SubjectsAuthors
(first, last)
![Page 4: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/4.jpg)
8/28/97 Information Organization and Retrieval
Database Data Models
• Network Model– Provides for single entries of data and
navigational “links” through chains of data.
Subjects Books
Authors
Publishers
![Page 5: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/5.jpg)
8/28/97 Information Organization and Retrieval
Database Data Models
• Relational Model– Provides a conceptually simple model for data
as relations (typically considered “tables”) with all data visible.
Book ID Title pubid Author id1 Introductio 2 12 The history 4 23 New stuff ab 3 34 Another title 2 45 And yet more 1 5
pubid pubname1 Harper2 Addison3 Oxford4 Que
Authorid Author name1 Smith2 Wynar3 Jones4 Duncan5 Applegate
Subid Subject1 cataloging2 history3 stuff
Book ID Subid1 22 13 34 24 3
![Page 6: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/6.jpg)
8/28/97 Information Organization and Retrieval
Database Data Models
• Object Oriented Data Model– Encapsulates data and operations as “Objects”
Books(id, title)
Publisher SubjectsAuthors
(first, last)
![Page 7: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/7.jpg)
8/28/97 Information Organization and Retrieval
Database Design Process
ConceptualModel
LogicalModel
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 8: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/8.jpg)
8/28/97 Information Organization and Retrieval
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 9: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/9.jpg)
8/28/97 Information Organization and Retrieval
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.
![Page 10: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/10.jpg)
8/28/97 Information Organization and Retrieval
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 11: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/11.jpg)
8/28/97 Information Organization and Retrieval
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 12: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/12.jpg)
8/28/97 Information Organization and Retrieval
Relationships
• Relationships are the associations between entities. They can involve one or more entities and belong to particular relationship types
• Examples derived from David R. McClanahan “Conceptual Design” DBMS Magazine January 1992, and “Hands-on Design”, February 1992.
![Page 13: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/13.jpg)
8/28/97 Information Organization and Retrieval
Relationships
ClassAttendsStudent
PartSuppliesproject
partsSupplier
Project
![Page 14: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/14.jpg)
8/28/97 Information Organization and Retrieval
Types of Relationships
• Concerned only with cardinality of relationship
TruckAssignedEmployee
ProjectAssignedEmployee
ProjectAssignedEmployee
1 1
n
n
1
m
![Page 15: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/15.jpg)
8/28/97 Information Organization and Retrieval
More Complex Relationships
ProjectEvaluationEmployee
Manager
1/n/n
1/1/1
n/n/1
ManagesEmployee
ProjectAssignedEmployee 4(2-10) 1
SSN ProjectDate
Manages
Is Managed By
1
n
![Page 16: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/16.jpg)
8/28/97 Information Organization and Retrieval
Today
• More on Entity-Relationship Diagrams
• Designing a database
![Page 17: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/17.jpg)
8/28/97 Information Organization and Retrieval
Weak Entities
• Owe existence entirely to another entity
Order-lineContainsOrder
Invoice #
Part#
Rep#
QuantityInvoice#
![Page 18: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/18.jpg)
8/28/97 Information Organization and Retrieval
Supertype and Subtype Entities
ClerkIs one ofSales-rep
Invoice
Other
Employee
Sold
Manages
![Page 19: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/19.jpg)
8/28/97 Information Organization and Retrieval
Many to Many Relationships
Employee
ProjectIsAssigned
ProjectAssignment
Assigned
SSN
Proj#
SSN
Proj#Hours
![Page 20: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/20.jpg)
8/28/97 Information Organization and Retrieval
Developing a Conceptual Model
• We will look at a small business
• Assume that we have 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 21: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/21.jpg)
8/28/97 Information Organization and Retrieval
Primary Business Operations
• The business sells parts to customers.– Each part has:
• A part number,
• A selling price,
• A description of the part,
• The count of the part currently in stock.
![Page 22: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/22.jpg)
8/28/97 Information Organization and Retrieval
Business Operations (cont.)
• Each sale is on an invoice to one customer.– Invoices contain:
• Line items for each part ordered,
• Total amount due for the invoice,
• Customer information:– Company name, address, and an ID number.
– Invoices are written up by one sales representative, who is credited with the sale
• Sales reps are paid a 5% commission on sales.
![Page 23: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/23.jpg)
8/28/97 Information Organization and Retrieval
Business Operations (cont.)
• Information must be kept on inventory of parts.
• There are multiple suppliers of parts:– The prices charged by different suppliers for a
given part may be different. This is the Cost of the part.
![Page 24: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/24.jpg)
8/28/97 Information Organization and Retrieval
Business Operations (cont.)
• Employee information includes:– Name,– Social Security Number,– Employee ID number,– Address,– Position.
• Hourly wages must be tracked for all employees (except sales reps).
![Page 25: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/25.jpg)
8/28/97 Information Organization and Retrieval
Business Operations (cont.)
• One account is kept for each customer to track charges, payments, and the current balance.
• The company needs to know if an order has been shipped.
• The accounting department must know which invoices have been paid.
• The total sales for each sales rep must be calculated.
![Page 26: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/26.jpg)
8/28/97 Information Organization and Retrieval
Business Operations (cont.)• We must know if a part is in stock at the company or
on order from a supplier.• Each hourly employee generates a time-card every
Monday morning.• Sales Reps don’t turn in time-cards, just their total
sales.• All employees are paid weekly by check.• We need a report each Monday telling us what each
employee should be paid for the previous week.
![Page 27: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/27.jpg)
8/28/97 Information Organization and Retrieval
Entities
• Customer• Invoice• Employee• Inventory• Supplier• Account• Sales Rep• Parts
• Timecard• Check
![Page 28: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/28.jpg)
8/28/97 Information Organization and Retrieval
Functional areas
• Ordering• Inventory• Supplies• Shipping• Personnel• Payroll• We will concentrate on Ordering and
Inventory
![Page 29: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/29.jpg)
8/28/97 Information Organization and Retrieval
Ordering
InvoiceRep-custinvoiceSales-Rep
Customer
Simple TernaryRelationship
![Page 30: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/30.jpg)
8/28/97 Information Organization and Retrieval
Ordering
InvoiceOrdersCustomer
Cust# Writes
Sales-Rep
Invoice#
Rep#
Parts Repeatingattribute
![Page 31: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/31.jpg)
8/28/97 Information Organization and Retrieval
Ordering Normalization
OrdersCustomer
Cust#
Invoice
Writes
Sales-Rep
Invoice#
Rep#
Rep#
Line-ItemContains
Part#
QuantityInvoice#
Cust#
![Page 32: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/32.jpg)
8/28/97 Information Organization and Retrieval
Parts and Suppliers
PartSuppliesSupplier
Company# Includes
Line-Item
Part#
Part#
Count
Price
Invoice#
m nIs this correct?Where does Pricebelong?
![Page 33: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/33.jpg)
8/28/97 Information Organization and Retrieval
Parts and Suppliers(alternative 2)
Company#
Contains
Line-ItemPart# Invoice#
Part
Part# Count
Price
n
m
Supplier
Company#
Offers
Supplied-Part
Part# Cost
Supplies
IntersectionEntity
![Page 34: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/34.jpg)
8/28/97 Information Organization and Retrieval
Parts and Suppliers (Alternative 3)
Company#
Contains
Line-ItemPart# Invoice#
Part
Part# Count
Price
Supplier
Company#
Supplies
Supplied-Part
Part# Cost
![Page 35: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/35.jpg)
8/28/97 Information Organization and Retrieval
Parts and Suppliers(Alternative Notation 4)
Company#
Contains
Line-ItemPart# Invoice#
Part
Part# Count
Price
mSupplier
Company#
Part# Cost
Supplying
![Page 36: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/36.jpg)
8/28/97 Information Organization and Retrieval
Parts and Suppliers(Alternative Notation 5)
Part
Part# Count
Price
mSupplier
Company# Cost
Supplies
![Page 37: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/37.jpg)
8/28/97 Information Organization and Retrieval
ER Model
OrdersCustomer
Cust#
Invoice
Writes
Sales-Rep
Invoice#
Sales
Rep#
Line-ItemContains
Part#
QuantityInvoice#
Cust#Contains
Part
Part# Count
Price
Supplier
Company#
OrderedPart
Hourly
Employee
ISA
Emp#Wage
Company#
Part# Cost
SuppliedPart
Has
On-Order
Supplies
Company#
Part# Quantity
![Page 38: 8/28/97Information Organization and Retrieval Database Design University of California, Berkeley School of Information Management and Systems SIMS 202:](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d7d5503460f94a5fd34/html5/thumbnails/38.jpg)
8/28/97 Information Organization and Retrieval
Next Time
• More on normalization
• Effectiveness and Efficiency criteria for database designs
• Advantages and failings of DBMS technology