Download presentation
Presentation is loading. Please wait.
Published byKevin Kelly Modified over 8 years ago
1
Next Back A-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module A Designing Databases and Entity-Relationship Diagramming
2
Next Back A-2 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Presentation Overview Designing and Building A Relational Database Designing and Building A Relational Database The four primary steps for designing a database include: The four primary steps for designing a database include: 1. Defining entity classes and primary keys. 2. Defining relationships among entity classes. 3. Defining information (fields) for each relation. 4. Using a data definition language to create your database.
3
Next Back A-3 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Databases are powerful and can aid your organization in both transaction and analytical processing Databases are powerful and can aid your organization in both transaction and analytical processing You must carefully build and design your database so it could be effective You must carefully build and design your database so it could be effective Introduction
4
Next Back A-4 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Database - a collection of information that you organize and access according to the logical structure of that information. Database - a collection of information that you organize and access according to the logical structure of that information. Relational database - uses a series of logically related two-dimensional tables or files to store information in the form of a database. Relational database - uses a series of logically related two-dimensional tables or files to store information in the form of a database. Introduction
5
Next Back A-5 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Designing And Building A Relational Database The four primary steps include: The four primary steps include: 1. Defining entity classes and primary keys. 2. Defining relationships among entity classes. 3. Defining information (fields) for each relation. 4. Using a data definition language to create your database.
6
Next Back A-6 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 1: Defining Entity Classes and Primary Keys Entity class Entity class An entity class is a concept such as people, places, or things - about which you wish to store information and that you can identify with a unique key (called the primary key). Primary key Primary key A primary key is a field (or group of fields in some cases) that uniquely describes each record. Instance Instance An instance is an occurrence of an entity class that can be uniquely described.
7
Next Back A-7 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 1: Defining Entity Classes and Primary Keys What are the entity classes and primary keys for the report in the next slide? What are the entity classes and primary keys for the report in the next slide?
8
Next Back A-8 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 1: Defining Entity Classes and Primary Keys Figure A.1 A sample report for your employee database page 117
9
Next Back A-9 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 1: Defining Entity Classes and Primary Keys The entity classes are The entity classes are Employee (primary key – Employee ID) Job (primary key – Job Number) Department (primary key Department Num) Team Work Defining Entity Classes and Primary Keys (p. 118)
10
Next Back A-10 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Entity-relationship (E-R) diagram - a graphic method of representing entity classes and their relationships. Entity-relationship (E-R) diagram - a graphic method of representing entity classes and their relationships. Rectangle – entity class Dotted line – relationship | - single relationship O – zero or optional relationship Crow’s foot – multiple relationship Step 2: Defining Relationships Among Entity Classes
11
Next Back A-11 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Figure A.2 An Entity- Relationship Diagram page 120
12
Next Back A-12 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Team Work Defining Relationships Among Entity Classes (p. 121)
13
Next Back A-13 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes To determine where the relationships exist, simply ask some questions and review your business rules To determine where the relationships exist, simply ask some questions and review your business rules
14
Next Back A-14 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes To look into the Employee-Department relationship: To look into the Employee-Department relationship: Business rule: An Employee is assigned to one Department at a minimum and one Department at a maximum.
15
Next Back A-15 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes For the relationship between Department- Employee: For the relationship between Department- Employee: Business rule: A Department is not required to have any Employees assigned to it but may have many Employees assigned to it.
16
Next Back A-16 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Figure A.3 Reading an Entity- Relationship Diagram page 122
17
Next Back A-17 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes All statements you derive from an E-R diagram should mirror the business rules at hand. All statements you derive from an E-R diagram should mirror the business rules at hand. Team Work Defining the Cardinality Among Entity Classes (p. 123)
18
Next Back A-18 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes The relationship is stated in two ways and it should also make sense from a business and logical perspectives. For example The relationship is stated in two ways and it should also make sense from a business and logical perspectives. For example Employee-department: An employee is assigned to a department Department-employee: A department has a employee assigned to it Employee-job: An employee undertakes a job Job-employee: A job is performed by an employee
19
Next Back A-19 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Once the relationship has been established, you must then determine the numerical nature of the relationship, referred to as minimum and maximum cardinalities Once the relationship has been established, you must then determine the numerical nature of the relationship, referred to as minimum and maximum cardinalities
20
Next Back A-20 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Statements need to be developed to determine the cardinalities: Statements need to be developed to determine the cardinalities: An employee must be assigned to one job at minimum and can be assigned to many jobs (maximum) A job might not have any employees assigned to it but might have many employees assigned to it.
21
Next Back A-21 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Now it’s time to employ normalization. Now it’s time to employ normalization. Normalization Normalization It is the process of assuring that a relational database structure can be implemented as a series of two-dimensional relations.
22
Next Back A-22 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes There are three rules of normalization: There are three rules of normalization: 1. Eliminate repeating groups or many-to-many relationships. 2. Assure that each field in a relation depends only on the primary key for that relation. 3. Remove all derived fields from the relations.
23
Next Back A-23 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes To eliminate repeating groups (many-to-many relationships) you must, create an intersection relation. To eliminate repeating groups (many-to-many relationships) you must, create an intersection relation. The figure on the next slide shows a many-to- many relationship and the intersection relation that eliminates it. The figure on the next slide shows a many-to- many relationship and the intersection relation that eliminates it.
24
Next Back A-24 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes The intersection relation (Job Assignment) uses a composite primary key. The intersection relation (Job Assignment) uses a composite primary key.
25
Next Back A-25 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Figure A.4 Creating an Intersection Relation to Remove a Many- to-Many Relationship page 124
26
Next Back A-26 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Intersection relation - a relation you create to eliminate a many-to-many relationship. Intersection relation - a relation you create to eliminate a many-to-many relationship. Composite primary key - consists of the primary key fields from the two intersecting relations. Composite primary key - consists of the primary key fields from the two intersecting relations. Foreign key - a primary key of one file (relation) that appears in another file (relation). Foreign key - a primary key of one file (relation) that appears in another file (relation).
27
Next Back A-27 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Guidelines for creating an intersection relation: Guidelines for creating an intersection relation: 1. Draw the part of the E-R diagram that contains a many-to- many relationship. 2. Underneath each relation for which the many-to-many relationship exists, write down some of the primary keys. 3. Create a new E-R diagram (showing no cardinality) with the original two relations on each end and a new one in the middle. 4. Underneath the intersection relation, write down some composite primary keys.
28
Next Back A-28 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes 5. Create a meaningful name for the intersection relation. 6. Move the minimum cardinality appearing next to the left relation just to the right of the intersection relation. 7. Move the minimum cardinality appearing next to the right relation just to the left of the intersection relation. 8. The maximum cardinality on both sides of the intersection relation will always be “many”. 9. The new minimum and maximum cardinalities for the two original relations will be one and one.
29
Next Back A-29 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 2: Defining Relationships Among Entity Classes Figure A.5 The Completed E-R Diagram for Your Employee Database page 124 Team Work Creating an Intersection Relation (p. 126)
30
Next Back A-30 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 3: Defining Information (Fields) for Each Relation Your goal in this step to make sure that Your goal in this step to make sure that the information in each relation is indeed in the correct relation and that the information cannot be derived from other information – the second and third rules of normalization.
31
Next Back A-31 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 3: Defining Information (Fields) for Each Relation Figure A.6 A First look at the Relations in Your Employee Database page 126
32
Next Back A-32 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 3: Defining Information (Fields) for Each Relation Department Name does not belong in the Employee relation. Department Name does not belong in the Employee relation. It depends on Department Num. It does not depend on Employee ID. Num of Employees does not belong in the Department relation. Num of Employees does not belong in the Department relation. It can be derived by counting employees in the Employee relation.
33
Next Back A-33 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 3: Defining Information (Fields) for Each Relation Figure A.7 The Correct Structure for Your Employee Database page 127
34
Next Back A-34 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 3: Defining Information (Fields) for Each Relation On Your Own Creating the Final Structure for Your School (p. 128)
35
Next Back A-35 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 4: a Data Definition Language to Create Your Database. Step 4: Using a Data Definition Language to Create Your Database. The final step in developing a relational database is to take the structure you created in steps 1 to 3 and use a data definition language to actually create the relation. The final step in developing a relational database is to take the structure you created in steps 1 to 3 and use a data definition language to actually create the relation. Read Module J on the CD to learn how to do this with Microsoft Access. Read Module J on the CD to learn how to do this with Microsoft Access.
36
Next Back A-36 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Step 4: a Data Definition Language to Create Your Database Step 4: Using a Data Definition Language to Create Your Database The data definition language is part of the DBMS. The data definition language is part of the DBMS. Database management system (DBMS) - helps you specify the logical organization for a database and access and use the information within the database. Database management system (DBMS) - helps you specify the logical organization for a database and access and use the information within the database.
37
Next Back A-37 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Summary Student Learning Outcomes 1. Identify how databases and spreadsheets are both similar and different. 2. List and describe the four steps in designing and building a relational database. 3. Define the concepts of entity class, instance, primary key, and foreign key.
38
Next Back A-38 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Summary Student Learning Outcomes 4. Given a small operating environment, build an entity-relationship (E-R) diagram. 5. List and describe the steps in normalization. 6. Describe the process of creating an intersection relation to remove a many-to- many relationship.
39
Next Back A-39 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Summary Assignments and Exercises 1. Defining entity classes for the music industry 2. Defining business rules for a video rental store 3. Creating an E-R diagram for a video rental store 4. Eliminating a many-to-many relationship
40
Next Back A-40 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Summary Assignments and Exercises 5. Defining the cardinality among two entity classes 6. Making some changes to your school’s offering of weekend seminars 7. Making some changes to your employee database
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.