Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design University of California, Berkeley

Similar presentations


Presentation on theme: "Database Design University of California, Berkeley"— Presentation transcript:

1 Database Design University of California, Berkeley
School of Information Management and Systems SIMS 202: Information Organization and Retrieval 11/30/2000 Information Organization and Retrieval

2 Information Organization and Retrieval
Last Time Databases and Files Database design Database life cycle Data Models 11/30/2000 Information Organization and Retrieval

3 Information Organization and Retrieval
DBMS Benefits Minimal Data Redundancy Consistency of Data Integration of Data Sharing of Data Ease of Application Development Uniform Security, Privacy, and Integrity Controls Data Accessibility and Responsiveness Data Independence Reduced Program Maintenance 11/30/2000 Information Organization and Retrieval

4 Information Organization and Retrieval
Database Environment CASE Tools DBMS User Interface Application Programs Repository Database 11/30/2000 Information Organization and Retrieval

5 Information Organization and Retrieval
Database Components DBMS =============== Design tools Table Creation Form Creation Query Creation Report Creation Procedural language compiler (4GL) ============= Run time Form processor Query processor Report Writer Language Run time Database Application Programs Database contains: User’s Data Metadata Indexes Application Metadata User Interface Applications Kroenke, Database Processing 11/30/2000 Information Organization and Retrieval

6 Information Organization and Retrieval
Terms and Concepts Database: A collection of similar records with relationships between the records. (Rowley) A Database is a collection of stored operational data used by the application systems of some particular enterprise. (C.J. Date) 11/30/2000 Information Organization and Retrieval

7 Information Organization and Retrieval
Terms and Concepts Enterprise Organization Entity Person, Place, Thing, Event, Concept... Attributes Data elements (facts) about some entity Also sometimes called fields or items or domains Data values instances of a particular attribute for a particular entity 11/30/2000 Information Organization and Retrieval

8 Information Organization and Retrieval
Terms and Concepts Key an attribute or set of attributes used to identify or locate records in a file Primary Key an attribute or set of attributes that uniquely identifies each record in a file 11/30/2000 Information Organization and Retrieval

9 Information Organization and Retrieval
Terms and Concepts Models (1) Levels or views of the Database Conceptual, logical, physical (2) DBMS types Relational, Hierarchic, Network, Object-Oriented, Object-Relational 11/30/2000 Information Organization and Retrieval

10 Information Organization and Retrieval
Models (1) Conceptual Model Logical External requirements Application 1 Application 2 Application 3 Application 4 Internal Model 11/30/2000 Information Organization and Retrieval

11 Database System Life Cycle
Physical Creation 2 Conversion 3 Design 1 Growth, Change, & Maintenance 6 Integration 4 Operations 5 11/30/2000 Information Organization and Retrieval

12 Another View of the Life Cycle
Integration 4 Operations 5 Design 1 Physical Creation 2 Conversion 3 Growth, Change 6 11/30/2000 Information Organization and Retrieval

13 Information Organization and Retrieval
Database Models Models(2): DBMS types Hierarchical Network Relational Object-Oriented 11/30/2000 Information Organization and Retrieval

14 Information Organization and Retrieval
Database Data Models Hierarchical Model Similar to data structures in programming languages. Books (id, title) Publisher Subjects Authors (first, last) 11/30/2000 Information Organization and Retrieval

15 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 11/30/2000 Information Organization and Retrieval

16 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. 11/30/2000 Information Organization and Retrieval

17 Information Organization and Retrieval
Database Data Models Object Oriented Data Model Encapsulates data and operations as “Objects” Books (id, title) Publisher Subjects Authors (first, last) 11/30/2000 Information Organization and Retrieval

18 Information Organization and Retrieval
Today More on Database Design Process Conceptual Model and ER Diagrams Creating the Logical Model Mapping ER diagrams to Relational tables 11/30/2000 Information Organization and Retrieval

19 Database Design Process
Application 1 Application 2 Application 3 Application 4 External Model External Model External Model External Model Application 1 Conceptual requirements Application 2 Conceptual requirements Conceptual Model Logical Model Internal Model Application 3 Conceptual requirements Application 4 Conceptual requirements 11/30/2000 Information Organization and Retrieval

20 Database Design Process
Conceptual Requirements Systems Analysis Process Examine all of the information sources used in existing applications Identify the characteristics of each data element numeric text date/time etc. Examine the tasks carried out using the information Examine results or reports created using the information 11/30/2000 Information Organization and Retrieval

21 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? 11/30/2000 Information Organization and Retrieval

22 Database Design Process
Logical Model How is each entity and relationship represented in the Data Model of the DBMS Hierarchic? Network? Relational? Object-Oriented? 11/30/2000 Information Organization and Retrieval

23 Database Design Process
Internal Model Choices of index file structure Choices of data storage formats Choices of disk layout 11/30/2000 Information Organization and Retrieval

24 Database Design Process
External Model User views of the integrated database Making the old (or updated) applications work with the new database design 11/30/2000 Information Organization and Retrieval

25 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. 11/30/2000 Information Organization and Retrieval

26 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 11/30/2000 Information Organization and Retrieval

27 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 11/30/2000 Information Organization and Retrieval

28 Information Organization and Retrieval
Relationships Relationships are the associations between entities. They can involve one or more entities and belong to particular relationship types 11/30/2000 Information Organization and Retrieval

29 Information Organization and Retrieval
Relationships Class Attends Student Part Supplies project parts Supplier Project 11/30/2000 Information Organization and Retrieval

30 Types of Relationships
Concerned only with cardinality of relationship Truck Assigned Employee Project 1 n m Chen ER notation 11/30/2000 Information Organization and Retrieval

31 Information Organization and Retrieval
Other Notations Truck Assigned Employee Project Assigned Employee Project Assigned Employee “Crow’s Foot” 11/30/2000 Information Organization and Retrieval

32 Information Organization and Retrieval
Other Notations Truck Assigned Employee Project Assigned Employee Project Assigned Employee IDEFIX Notation 11/30/2000 Information Organization and Retrieval

33 More Complex Relationships
Project Evaluation Employee Manager 1/n/n 1/1/1 n/n/1 SSN Date Project Project Assigned Employee 4(2-10) 1 Manages 1 Manages Employee Is Managed By n 11/30/2000 Information Organization and Retrieval

34 Information Organization and Retrieval
Weak Entities Owe existence entirely to another entity Order-line Contains Order Invoice # Part# Rep# Quantity Invoice# 11/30/2000 Information Organization and Retrieval

35 Supertype and Subtype Entities
Clerk Is one of Sales-rep Invoice Other Employee Sold Manages 11/30/2000 Information Organization and Retrieval

36 Many to Many Relationships
Project Is Assigned Assignment SSN Proj# Hours Employee 11/30/2000 Information Organization and Retrieval

37 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... 11/30/2000 Information Organization and Retrieval

38 Primary Business Operations
The business (ACME Widget Co.) 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. 11/30/2000 Information Organization and Retrieval

39 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. 11/30/2000 Information Organization and Retrieval

40 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. 11/30/2000 Information Organization and Retrieval

41 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). 11/30/2000 Information Organization and Retrieval

42 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. 11/30/2000 Information Organization and Retrieval

43 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. 11/30/2000 Information Organization and Retrieval

44 Information Organization and Retrieval
Entities Customer Invoice Employee Inventory Supplier Account Sales Rep Parts Timecard Check 11/30/2000 Information Organization and Retrieval

45 Information Organization and Retrieval
Functional areas Ordering Inventory Supplies Shipping Personnel Payroll We will concentrate on Ordering and Inventory 11/30/2000 Information Organization and Retrieval

46 Information Organization and Retrieval
Ordering Invoice Rep-cust invoice Sales-Rep Customer Simple Ternary Relationship 11/30/2000 Information Organization and Retrieval

47 Information Organization and Retrieval
Ordering Invoice Orders Customer Cust# Writes Sales-Rep Invoice# Rep# Parts Repeating attribute 11/30/2000 Information Organization and Retrieval

48 Ordering Normalization
Orders Customer Cust# Invoice Writes Sales-Rep Invoice# Rep# Line-Item Contains Part# Quantity 11/30/2000 Information Organization and Retrieval

49 Information Organization and Retrieval
Parts and Suppliers Part Supplies Supplier Company# Includes Line-Item Part# Count Price Invoice# m n Is this correct? Where does Price belong? 11/30/2000 Information Organization and Retrieval

50 Parts and Suppliers (alternative 2)
Company# Contains Line-Item Part# Invoice# Part Count Price n m Supplier Offers Supplied-Part Cost Supplies Intersection Entity 11/30/2000 Information Organization and Retrieval

51 Parts and Suppliers (Alternative 3)
Company# Contains Line-Item Part# Invoice# Part Count Price Supplier Supplies Supplied-Part Cost 11/30/2000 Information Organization and Retrieval

52 Parts and Suppliers (Alternative Notation 4)
Company# Contains Line-Item Part# Invoice# Part Count Price m Supplier Cost Supplying 11/30/2000 Information Organization and Retrieval

53 Parts and Suppliers (Alternative Notation 5)
Cost Supplier Company# Supplies Part Part# Count Price m 11/30/2000 Information Organization and Retrieval

54 Information Organization and Retrieval
Orders Customer Cust# Invoice Writes Sales-Rep Invoice# Sales Rep# Line-Item Contains Part# Quantity Part Count Price Supplier Company# Ordered Hourly Employee ISA Emp# Wage Cost Supplied Has On-Order Supplies ER Model 11/30/2000 Information Organization and Retrieval

55 Mapping to a Relational Model
Each entity in the ER Diagram becomes a relation. A properly normalized ER diagram will indicate where intersection relations for many-to-many mappings are needed. Relationships are indicated by common columns (or domains) in tables that are related. We will examine the tables for the Acme Widget Company derived from the ER diagram 11/30/2000 Information Organization and Retrieval

56 Information Organization and Retrieval
Employee 11/30/2000 Information Organization and Retrieval

57 Information Organization and Retrieval
Sales-Rep Hourly 11/30/2000 Information Organization and Retrieval

58 Information Organization and Retrieval
Customer 11/30/2000 Information Organization and Retrieval

59 Information Organization and Retrieval
Invoice 11/30/2000 Information Organization and Retrieval

60 Information Organization and Retrieval
Line-Item 11/30/2000 Information Organization and Retrieval

61 Information Organization and Retrieval
Part 11/30/2000 Information Organization and Retrieval

62 Information Organization and Retrieval
Joins 11/30/2000 Information Organization and Retrieval

63 Information Organization and Retrieval
Next Time More on normalization SQL Effectiveness and Efficiency criteria for database designs Advantages and failings of DBMS technology 11/30/2000 Information Organization and Retrieval


Download ppt "Database Design University of California, Berkeley"

Similar presentations


Ads by Google