We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byRowan Braddock
Modified over 2 years ago
Chapter 4 Database Design Chapter4.1 Copyright © 2014 Pearson Education Inc.
Copyright ©2014 Pearson Education, Inc. Logical Design Logical design is the entity design without regard to a relational database management system. One of the principles of relational database is that the logical design should be the same regardless of the DBMS that will be used. This means you dont consider the particular limitations or features of a DBMS in the design. Chapter4.2
Copyright ©2014 Pearson Education, Inc. Physical Design Physical design is the logical design adapted to a particular DBMS. The design can change slightly to fit into the limitations of a DBMS or to take advantage of DBMS-specific features. Chapter4.3
Copyright ©2014 Pearson Education, Inc. Entity Relation Diagrams Entity relation diagrams are a common way of diagramming entities, their attributes, and their relationships. An entity is represented as a rectangle divided into three parts: The name of the entity The primary key The attributes Chapter4.4
Copyright ©2014 Pearson Education, Inc. An Entity Attributes in bold are required Chapter4.5
Copyright ©2014 Pearson Education, Inc. Relationships A relationship between entities is established by repeating one field, usually the primary key field, from one table in a second table, usually as a foreign key. The primary key table is sometimes referred to as the parent table. Tables with the foreign keys are referred to as child tables. Chapter4.6
Copyright ©2014 Pearson Education, Inc. Crows Feet Notation for Relationships The three lines, the crows foot, shows the many side of the relationship. The 0 on the building side says a building can have zero or many rooms, the line on the room side says a room must have a building. Chapter4.7
Copyright ©2014 Pearson Education, Inc. Naming Conventions Naming conventions are crucial for good design. Ideally you should have a consistent way of naming database objects, such as tables, attributes, keys, and any other database objects, such as stored procedures and triggers. Chapter4.8
Copyright ©2014 Pearson Education, Inc. Book Naming Conventions Entities and tables are named as single nouns like Tutor, Student, and Session. Attributes are named with the entity name followed by the attribute name. There are no underscores between. Each new word is capitalized: TutorLastName, StudentLastName, and so on. This can make for long attribute names, but it makes for maximum clarity. Primary keys end with the word Key: TutorKey, StudentKey, and so on. Foreign keys retain the name of the primary key. Chapter4.9
Copyright ©2014 Pearson Education, Inc. Term Equivalencies Logical DesignPhysical designTheoretical EntityTableRelation AttributeColumn, fieldAttribute Row, recordTuple Chapter4.10
Copyright ©2014 Pearson Education, Inc. Repeating Fields When creating an entity that can contain many of the same attributes, it is tempting to list or number them. For example, a tutor can tutor many classes. The temptation is to create an entity like the following (see next slide): Chapter4.11
Copyright ©2014 Pearson Education, Inc. Repeating Attribute Entity Chapter4.12
Resolution Numbering attributes is always a mistake. It is a sign that you should split the entity into two separate entities Chapter4.13 Copyright © 2014 Pearson Education Inc.
Copyright ©2014 Pearson Education, Inc. Relationships There are three types of relationships between entities: One to one One to many Many to many Chapter4.14
Copyright ©2014 Pearson Education, Inc. One to One A one-to-one relationship means that for every one record in the primary key table, there is no more than one related record in the foreign key table. Below are the crows feet notation for this relationship: Zero or one Exactly one Chapter4.15
Copyright ©2014 Pearson Education, Inc. Notes on One-to-One Relationships One-to-one relationships are rare. They can be used to rid an entity of null (empty) attributes that inevitably result when contents of an entity have different attributes. They are sometimes used when data is split between entities for security reasons. Chapter4.16
Copyright ©2014 Pearson Education, Inc. One-to-One Relationship to Prevent Nulls Chapter4.17
Copyright ©2014 Pearson Education, Inc. Table Example: One to One For Reducing Nulls Chapter4.18
Copyright ©2014 Pearson Education, Inc. One to One for Security Reasons Chapter4.19
Copyright ©2014 Pearson Education, Inc. One to Many One to many is the normal relationship between tables. It means that for every one record in the parent entity, there can be zero to infinity records in the child entity. Here are the crows feet symbols for one to many relationships: One to zero or many At least one or many Chapter4.20
Copyright ©2014 Pearson Education, Inc. One to Many Diagram One Department can contain many Employees Chapter4.21
Copyright ©2014 Pearson Education, Inc. Table Example of One to Many DepartmentKeyDepartmentNameDepartmentPhoneDepartmentRoom ACCAccounting(206) SB201 ITInformation Technology (206) NB100 EmployeeKeyEmployeeLastNameEmployeeFirstNameDepartmentKey FB2001DCollinsRichardIT BN2004NFaulknerLeonoreIT NC2004MBrownCarolACC LL2006OAndersonThomasIT Chapter4.22
Copyright ©2014 Pearson Education, Inc. Caution: Cross Relationship Error There is a temptation to think that because a department contains many employees, that the relationship should go both ways. Doing this, however, makes it impossible to enter data since before you enter a department, there must be an existing employee in the Employee table, and before you enter an employee, there must be an existing department in the Department table. The result is an unusable stalemate. Chapter4.23
Copyright ©2014 Pearson Education, Inc. Many to Many A many-to-many relationship means that each record in the primary entity can have many related records in a second entity and each record in the second entity can have many related records in the primary entity. Many-to-many relationships are legal in logical design, but no DBMS can implement them. Chapter4.24
Copyright ©2014 Pearson Education, Inc. Example of a Many-to-Many Entity Relationship Chapter4.25
Copyright ©2014 Pearson Education, Inc. Resolving Many-to-Many Relationships Many-to-many relationships must be resolved into two one-to- many relationships. To do this, it is necessary to create a linking between the two tables that have many-to-many relationships. Chapter4.26
Copyright ©2014 Pearson Education, Inc. Many-to-Many Relationship Resolved Chapter4.27
Copyright ©2014 Pearson Education, Inc. Table View: Magazine and Subscriber MagazineKeyMagazineNameMagazinePrice TM2K1Time35.50 NW2K1Newsweek36.40 SubscriberKey Subscriber LastName Subscriber FirstName Subscriber Address Subscriber City Subscriber State Subscriber PostalCode 4231JohnsonLeslie101 Best Ave.SeattleWA AndersonMark 1200 Western Blvd. TacomaWA ManningTabitha100 WestlakeSeattleWA98008 Chapter4.28
Copyright ©2014 Pearson Education, Inc. Linking Table: Subscription SubscriptionKeyMagazineKeySubscriberKeySubscriptionStartDate 1004TM2K143331/15/ NW2K143331/15/ NW2K142312/1/ TM2K153442/15/2009 Chapter4.29
Copyright ©2014 Pearson Education, Inc. Cardinality Cardinality describes the number of permissible relationships between two entities. Maximum cardinality refers to the maximum number of permitted relationships. (For example, a customer can have no more than 4 listed s.) Minimum cardinality refers the minimum number of permitted relationships. (For example, each customer must have at least one purchase in the purchase table.) Chapter4.30
Copyright ©2014 Pearson Education, Inc. Types or Roles of Entities Entities can take on different roles. Below is a table of some common roles or types: Entity RolesDescription DomainEntity describing a core business element of the database Linking Entity used to resolve a many-to-many relationship into two one-to-many relationships Lookup Entity used to store lookup values and help ensure data integrity and consistency WeakAn entity that depends on another entity for its meaning Chapter4.31
Copyright ©2014 Pearson Education, Inc. Example of a Weak Entity An employee can have many dependents, so it is a good design practice to create a separate entity to describe dependents. However, the Dependent entity is a weak entity because it depends on Employee for its meaning. Chapter4.32
Copyright ©2014 Pearson Education, Inc. Documentation Diagrams often communicate more clearly than words. It is important to keep all your entity diagrams for documentations along with notations about changes and versions. Chapter4.33
Copyright ©2014 Pearson Education, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Chapter4.34
IT203 Unit 3: Database Design Database Design Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter4.1.
IT203 Unit 2: Gather Information and Define Requirements Gathering Information Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter2.1.
Author: Graeme C. Simsion and Graham C. Witt Chapter 5 Attributes and Columns.
IT203 Unit 1: Database Concept Who Needs a Database? Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter 1.1.
Entity Relationship (ER) Modeling The ER Model Developing and ER Diagram Extended ER Model Entity Integrity : Selecting Primary Key Chapter 4.
IT203 Unit 9: Database Security II Is It Secure? Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter8.1.
IT203 Unit 6: SQL Queries I SQL Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter7.1.
IT203 Unit 5: Physical Design Physical Design Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter6.1.
Monica Farrow EM G30 Material on Vision Er 1 F28DM: Database Management Systems The Entity Relationship Model.
Author: Graeme C. Simsion and Graham C. Witt Chapter 4 Subtypes & Supertypes.
9/2/2014 1Yan Huang - ER Chapter 6: ER – Entity Relationship Diagram Major components of ER diagram Major components of ER diagram Practices Practices.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Data Analysis 1 Chapter 2.1 V3.1 Napier University Dr Gordon Russell.
© 2005 by Prentice Hall Chapter 9 Structuring System Data Requirements Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George.
Entity/Relationship Modelling. Topics To Be Covered In This Lecture Entity/Relationship models Entities and Attributes Relationships Attributes E/R Diagrams.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 10 Object-Oriented Analysis and Modeling Using the UML.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
© 2014 by McGraw-Hill Education. This is proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
1 Term 2, 2004, Lecture 5, Physical DesignMarian Ursu, Department of Computing, Goldsmiths College Physical Design 3.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 4 Entity Relationship.
1 Notes content copyright © 2004 Ian Sommerville. NU-specific content copyright © 2004 M. E. Kabay. All rights reserved. System Models IS301 – Software.
©Silberschatz, Korth and Sudarshan8.1Database System Concepts Chapter 8: Object-Oriented Databases Need for Complex Data Types The Object-Oriented Data.
New Mexico Broadband Program Introduction to the Internet Module 1 Understanding the Internet Key Features of Websites Navigating within a website.
Copyright © 2003 Pearson Education, Inc. Slide 1.
DataBase Data Modeling Using the Entity-Relationship Model.
Copyright: SIPC Applying 4D ontologies to Enterprise Architecture Matthew West Reference Data Architecture and Standards Manager – Shell.
Copyright © Cengage Learning. All rights reserved. 6 Sets and Counting.
Copyright © 2009 Pearson Education, Inc. Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 1- 1 A Framework for Human Resource Management,
© 2016 SlidePlayer.com Inc. All rights reserved.