Chapter 4 Database Design Chapter4.1 Copyright © 2014 Pearson Education Inc.

Slides:



Advertisements
Similar presentations
1 Senn, Information Technology, 3 rd Edition © 2004 Pearson Prentice Hall James A. Senns Information Technology, 3 rd Edition Chapter 7 Enterprise Databases.
Advertisements

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to XHTML Programming the World Wide Web Fourth edition.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 1 Embedded Computing.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 3 CPUs.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
Database Design DB Chapter 5 J.G. Zheng June 29th 2005.
UNITED NATIONS Shipment Details Report – January 2006.
IT203 Unit 9: Database Security II Is It Secure? Copyright © 2012 Pearson Education, Inc. Publishing as Prentice HallChapter8.1.
IT203 Unit 3: Database Design
Exit a Customer Chapter 8. Exit a Customer 8-2 Objectives Perform exit summary process consisting of the following steps: Review service records Close.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Year 6 mental test 10 second questions
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Information Systems Today: Managing in the Digital World
Database Design Process
INSERT BOOK COVER 1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Excel 2010 by Robert Grauer, Keith.
© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall.
Database Design Chapter Five DATABASE CONCEPTS, 6th Edition
Microsoft Access.
Chapter Information Systems Database Management.
Chapter 6 Data Design.
Access Tables 1. Creating a Table Design View Define each field and its properties Data Sheet View Essentially spreadsheet Enter fields You must go to.
VOORBLAD.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
© 2012 National Heart Foundation of Australia. Slide 2.
Chapter 6: ER – Entity Relationship Diagram
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Skills for Success with Microsoft® Office 2010
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
25 seconds left…...
Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques
Chapter Ten Marketing Communications and Customer Response.
Analyzing Genes and Genomes
Speak Up for Safety Dr. Susan Strauss Harassment & Bullying Consultant November 9, 2012.
International Opportunities
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 12 View Design and Integration.
Essential Cell Biology
Intracellular Compartments and Transport
PSSA Preparation.
Statistically-Based Quality Improvement
International Strategy and Organization
Essential Cell Biology
Retail Organization and Human Resource Management
Immunobiology: The Immune System in Health & Disease Sixth Edition
1 Chapter 13 Nuclear Magnetic Resonance Spectroscopy.
 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Chapter 14 Managing Quality Improvement Teams and Projects.
Energy Generation in Mitochondria and Chlorplasts
Financial Merchandise Management
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 2Advanced Reports, Access Tools, and Customizing Access Chapter 8Integrating Access Data.
© Copyright 2011 John Wiley & Sons, Inc.
Data Modeling and the Entity-Relationship Model
Database Design Chapter Five DATABASE CONCEPTS, 6th Edition
Entity-Relationship Model
Data Modeling and the Entity-Relationship Model Chapter Four DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 5 th Edition.
Entity-Relationship Model
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Five: Data Modeling with the Entity-Relationship.
Presentation transcript:

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