Lecture 10 Conversion to tables Database Design Concepts INFO1408.

Slides:



Advertisements
Similar presentations
Relationships Relational Database. Identifying Entities… In the previous tutorial you learnt about identifying entities in a flat file database. Also.
Advertisements

Transformation of an ER Model into a Relational Database Schema Translating to Software.
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Revised by Ivor Perry Sept Introduction to Data Modelling.
CIT 381 Slides part 3. Review: One-to-many and many-to-one One movie is stored on many videos – many videos are in one store. Both relationships are mandatory.
ER Modelling III Example Digital Voice Systems Data Modelling Deriving Tables Types Mapping to SQL DDL.
Entity Relationship Diagrams Basic Elements and Rules.
Database design concepts info1408 Lecture 8 Worked example of E:R Modelling.
Entity-Relationship Model and Diagrams (continued)
Database design concepts info1408 Lecture 8 Worked example of E:R Modelling.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Database Design Concepts Info1408
Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Entity Relationships. Relationships Relationships exist between entities The type of relationship is entirely dependent on the business rules The business.
MIS2502: Data Analytics Relational Data Modeling
Logical Database Design Nazife Dimililer. II - Logical Database Design Two stages –Building and validating local logical model –Building and validating.
Mapping ERM to relational database
 An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships between entities in a database.  An Entity Relationship.
Practical tips for creating entity relationship diagrams (ERDs) Chitu Okoli Associate Professor in Business Technology Management John Molson School of.
Class Agenda – 04/04/2006 Discuss database modeling issues
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 1.
Database Design Concepts
1 Introduction to modeling Relational modelling Slides for this part are based on Chapters 11 from Halpin, T. & Morgan, T. 2008, Information Modeling and.
DATA MODELING AND DATABASE DESIGN
Creating databases for web applications SQL. Systems design. ER diagrams. Data flow diagrams. Storyboards. Homework: Plan database and applications for.
Conceptual Design Lecture - 2 Database Development.
BTEC National Extended Diploma1 IT Systems Analysis and Design Entity Relationship Diagrams.
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
1 Entity-Relationship Diagram. 2 Components of ERD: –Entity –Relationship –Cardinality –Attributes.
Section 08 (a)ER Modelling In Practice1 HSQ - DATABASES & SQL And Franchise Colleges 08 (a) ER Modelling In Practice QUICKHIRE Car Company.
IS 230Lecture 4Slide 1 Entity Relationship to Relational Model Mapping Lecture 5.
Revision Instructor: Mohamed Eltabakh 1.
Next Back A-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights.
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling.
Description and exemplification of entity-relationship modelling.
Btec National - Advanced Databases 1 Advanced Databases Entity Relationship Diagrams.
Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 2 – Relationships and Lookup fields.
In this session, you will learn to: Map an ER diagram to a table Objectives.
Section 11ER Tables1 HSQ - DATABASES & SQL And Franchise Colleges 11 ER Tables By MANSHA NAWAZ.
1 CS 430 Database Theory Winter 2005 Lecture 15: How to Convert an ER Model to Relations.
Relational Theory and Design
Quiz questions. 1 A data structure that is made up of fields and records? Table.
WXGE 6101 DATABASE CONCEPTS & IMPLEMENTATIONS. Lesson Overview The Relational Model Terminology of relational model. Properties of database relations.
Database Design – Lecture 4 Conceptual Data Modeling.
Subtype Mapping. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –State and apply the table, column, identifiers,
MIS2502: Data Analytics Relational Data Modeling
1 DATABASE TECHNOLOGIES (Part 2) BUS Abdou Illia, Fall 2015 (September 9, 2015)
Week 7-8 DBMS ER-Relational Mapping. ER-Relational Mapping.
Tutorial 2 Data Modelling. 3 Terminology & Notation(1) An entity is an object about which the system needs to hold information –Customer, Student, Course.
Btec National - IT SYSTEMS ANALYSIS AND DESIGN 1 IT Systems Analysis and Design Entity Relationship Diagrams.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
EntityRelationshipDiagrams. Entity Relationship Models The E-R (entity-relationship) data model views the real world as a set of basic objects (entities)
Hoi Le. Why database? Spreadsheet is not good to: Store very large information Efficiently update data Use in multi-user mode Hoi Le2.
IS 4420 Database Fundamentals Chapter 3: Modeling Data in the Organization Leon Chen.
DATA MODELING AND DATABASE DESIGN
MIS2502: Data Analytics Relational Data Modeling
Database Design – Lecture 4
Order Database – ER Diagram
Data Modelling Introduction
Database Fundamentals
MIS2502: Data Analytics Relational Data Modeling
MIS2502: Data Analytics Relational Data Modeling
DBMS ER-Relational Mapping
DATA MODELING AND DATABASE DESIGN
Presentation transcript:

Lecture 10 Conversion to tables Database Design Concepts INFO1408

2 Introduction The entities in our ERDs become tables in our design How do the relationships in our ERDs affect our table designs? In this lecture we will look at posting identifiers to give foreign keys to link the tables together Dealing with the relationships one at a time.

3 1:M – many end Obligatory Every Machine has exactly one Employee, so we can post the primary key of Employee into the Machine table, thus forming a foreign key: Emp (emp#, …….) Machine (machine#, emp#, ……..) This is the most common pattern on any ERD The dot by the “ 1 ” is irrelevant to the tables. EmployeeMachine works on M 1  Post 

4 1:M – Many end optional We can’t use POSTING so we need a relationship table Employee Machine works on M 1   table required

5  Put the Primary Keys from each end in the new table Emp (emp#, …….) Machine: (machine#, ……..) Works_on (machine#, emp#, ……..) For a 1:M relationship table the many end always provides the Primary Key (Why? Remember the primary key determines each attribute) Again, the dot by the “ 1 ” is irrelevant to the tables We add a “ table required ” note to the diagram, but we do not add a new entity.

6 M:M Relationships All M:M relationships should have been decomposed during modelling. Refer to the lecture last week.

7 1:1 Optional:Obligatory Every machine has exactly one employee, so we can post the employee number into the Machine table: (optional end ’ s identifier into the mandatory end) Emp (emp#, …….) Machine (machine#, emp#, …...). EmployeeMachine works on 1 1   Post

8 1:1 Optional:Optional We can ’ t use POSTING Therefore, the relationship must be represented by a new table Employee Machine works on 11  table required

9 Emp (emp#, …….) Machine (machine#, …….., ) Works_on (emp#, machine#, ……..) or Works_on (emp#, machine#, ……..) Either can be the identifier.

10 1:1 Obligatory:Obligatory Every employee works on exactly one machine, and every machine is worked on by exactly one employee We could post both ways! EmployeeMachine works on 1 1 

11 This should be collapsed into one table: Emp (emp#, emp_name, ….., machine#, machine_location ……..) Basically avoid this pattern in ERDs - it usually means the two entities are really the same thing, and is rarely correct.

12 Summary of Mapping Rules Here is an important summary of the Entity- Relationship Diagram to Table types mapping rules: The only dots (participation condition) shown are those which affect the structure of the tables Your final ER diagram should not show un- decomposed M:M relationships

13 Completing the tables You should now have several tables from your E:R model Each table will have a unique identifier or key field Some tables will have a posted or foreign key Finally allocate the attributes to a table- We will practice this in the tutorials

14 Some Examples Represent the relationships on the following slides in the correct way, i.e. by either collapsing into one table posting the identifier of one table into the other creating a table for the relationship.

15 Example 1 Player Game plays 1 M Player(player#, name,...) Game(game#, date,...)

16 Example 2 Manager Store runs 11 Manager(staff#, name,...) Store(store#, location,...)

17 Example 3 Vehicle Sales Rep allocated to 1M Vehicle(vehicle#, type,...) Sales Rep(staff#, area,...)

18 Example 4 Lecture Theatre Projector fitted with 11 Lecture Theatre(room#, capacity,...) Projector(equipment#, date_purchased,...)

19 Summary Conversion to tables is the last stage of the the E:R modelling process. Learn the rules of what to do based on the properties of the relation ship. The tables given will form the basis of the implementation. The primary and foreign keys will have been identified Take care to make sure all other attributes are only allocated to one table