G045 Lecture 09 ERD Diagrams (Entity Relationship Diagrams) Mr C Johnston ICT Teacher www.computechedu.co.uk.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2.1: Relational Databases.
Advertisements

UNIVERSITY OF PALESTINE business computer application College of Business Instructor: Mr. Ahmed Abumosameh.
ENTITY RELATIONSHIP MODELLING
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
GCSE Computing#BristolMet Session Objectives# 21 MUST describe methods of validating data as it is input. SHOULD explain the use of key fields to connect.
Normalisation Ensuring data integrity in database design 1.
Chapter 2 The Relational Database Model
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Access Lecture 1 Database Overview and Creating Tables Create an Employee Table.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
Entity/Relationship Modelling
APPENDIX C DESIGNING DATABASES
The Relational Database Model
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 1.
Entity Relationship Modeling
DATA MODELLING TOOLS FOR ORGANISING DATABASES. For a database to be organised and logical, it must be well-designed and set out. In such cases, the databases.
Driving School Database
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
G057 - Lecture 02 Introduction To Database System Concepts Mr C Johnston ICT Teacher
44220: Database Design & Implementation Implementing Physical Domains Ian Perry Room: C49 Tel Ext.: 7287
BTEC Unit 06 – Lesson 06 Evidencing P4 Mr C Johnston ICT Teacher
WEEK 10 Database Design. Agenda – Week 10 Review Hybrid Review Table Instance Charts Primary Keys Normalization.
Data Modelling. ICT5 Introduction Historical development with most organisations Small-scale origins Individual computers bought for particular applications.
Fundamentals of Relational Database Operations
Complete theory from last lesson… Put today’s date in the front of your book Read pages 46 and 47 of the textbook…
Chapter 5: Data Types (2013) Revision Candidates should be able to know: Identify different data types? Key terms: File, record, field and key field Database.
WEEK 10 Database Design. Agenda – Week 10 Review Hybrid Review Primary Keys Table Instance Charts.
© Relational Databases. © Entities Data is stored in tables. Each table is concerned with one entity An entity is a.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
1. Objectives At the end of this chapter you should be able to:  Discuss the use and features of a data model  Define the terms entity and attribute.
Entity-Relationship (ER) Modelling ER modelling - Identify entities - Identify relationships - Construct ER diagram - Collect attributes for entities &
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Chapter 7 Data Modeling with Entity Relationship Diagrams
Handling Many to Many Relationships. 2 Handling Many:Many Relationships Aims: To explain why M:M relationships cannot be implemented in relational database.
IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling.
Description and exemplification of entity-relationship modelling.
ERD ( Conceptual data model From the statement of data requirements a conceptual data model is produced. This describes.
G045 Lecture 08 DFD Level 1 Diagrams (Data Flow Diagrams Level 1)
G045 Lecture 07 DFD Context Diagrams (Data Flow Diagrams Level 0)
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
44220: Database Design & Implementation Implementing Physical Domains Ian Perry Room: C41C Tel Ext.: 7287
Database Design – Lecture 6 Moving to a Logical Model.
Data Tonga Institute of Higher Education. Variables Programs need to remember values.  Example: A program that keeps track of sales needs to remember.
Study Opportunities1 Database table quiz What is your name?
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Mr C Johnston ICT Teacher
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
Sample Table Standard Notation Entity name in uppercase
Howard Paul. Sequential Access Index Files and Data File Random Access.
DATA SCIENCE MIS0855 | Spring 2016 Designing Data
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
G057 - Lecture 05 From Scenario To Design Mr C Johnston ICT Teacher
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Data Base Design Steps 1.Define Entity Classes (Relations/Tables) and Keys. 2.Define Relationships between Entity Classes. Normalization Steps Eliminate.
2b. Create an Access Database Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
BTEC NCF IT Unit 02 Creating Systems to Manage Information Lesson 05 – Data Types Mr C Johnston.
Databases Chapter 9 Asfia Rahman.
Mr C Johnston ICT Teacher
BTEC NCF IT Unit 02 Creating Systems to Manage Information Lesson 05 – Data Types Mr C Johnston.
Mr C Johnston Sidney Stringer Academy
Entity relationship diagrams
Database Theory.
Databases.
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
ICT Database Lesson 2 Designing a Database.
Databases This topic looks at the basic concept of a database, the key features and benefits of a Database Management System (DBMS) and the basic theory.
Presentation transcript:

G045 Lecture 09 ERD Diagrams (Entity Relationship Diagrams) Mr C Johnston ICT Teacher

Session Objectives Understand what an Entity Relationship Diagram is and what they show, Know the different components of an ERD and how together they can make a diagram, Know about supporting documentation for ERDs, Be able to draw ERDs and produce supporting documentation for given scenarios.

Entity Relationship Diagrams An entity is a person, place, event, or thing for which we intend to collect /store data University -- Students, Faculty Members, Courses Airlines -- Pilots, Aircraft, Routes, Supplier Each entity has a number of characteristics known as attributes Student – Student ID, Name, DOB, Home Address, Aircraft – Aircraft Number, hours flown, last maintenance date, Entities within an organisation are related to one another and are shown within a diagram The diagram shows symbolically how the entities relate to one an other.

Entity Relationships A relationship is a link or associations between entities. Normally one dentist has many patients There are three types of relationships: One–to–One (one student has one address) One–to–Many (one student has many grades) Many–to–Many (one student has many students BUT one teacher has many students) Due to database rules however we only use: One – to – Many relationships when designing data structures. Any many-to-many relationships which you discover will need removing.

Entity Relationships Diagrams EMPLOYEECOMPANY CAR drives WARDPATIENT holds ALBUMSINGERS features This is a way of showing relationships between entities, Entity names are always written in capitals and appear in rectangles, Lines join entities together and have: Symbol to show the degree of the relationship, A description to show the name of the relationship,

Many – To – Many Resolve Many - to – Many relationships are not allowed so we have to resolve them: To do this we introduce an additional entity between them splitting them up and creating 2 one - to – many relationships.

Quick Exercise 1)Draw an entity relationship diagram to show the relationship between Product and Component (assume company makes 1 component) House and Street Pet Owner and Pet 2)Draw an entity relationship diagram providing a many – to – many resolve to show the relationship between Product and Component (assume company makes lots of components) Student and A-Levels in a school Stock and Supplier in a newsagent (assume same products are available from different suppliers)

Supporting Documentation Once the ERD diagram is complete we then need to produce supporting documentation, Supporting documentation involves a description of the relationship and thinking about individual data items stored within an entity – (an attribute), Attributes have a name, a data type, rules, key fields will also be declared. Attributes will be detailed in a table as shown below EntityKeyAttributeData typeSize STUDENTPrimaryStudentID Title First Name Second Name Post Code AutoNumber Text Auto 4chars 15chars 20chars 8chars

Attribute Data Types Attributes must be one of the following data types: Text or String, Numeric, Date and Time, Currency, Boolean or Logical, AutoNumber.

Attribute Data Types Text or String: Consists of a sequence of any characters, Limited to 255 characters, For longer text requirements you can use a memo data type. Number: Byte: 0 to 255 Integer: -32,768 to 32,768 Long Integer: 2,147,483,648 to 2,147,483,647 Single: small decimal numbers (7dp) Double: medium decimal numbers (15dp) Decimal: large decimal numbers (28dp)

Attribute Data Types Date and Time General Date – 19/06/ :34:23 Long Date – 19 June 1994 Medium Date – 19 – JUN - 94 Short Date – 19/06/1994 Long Time – 17:34:23 Medium Time – 05:34 PM Short Time – 17:34 Currency Offers more precision for storing prices Boolean / Logical True, False On, Off Yes, No

Using The Correct Data Types You must ensure that the correct data type is chosen for an attribute The larger the maximum value the more memory in the database is taken up E.g phone numbers don’t need to be calculated with so can be stored as text

Key Fields  Each entity will have a primary key – this is a unique identifier for each set of data within it,  To join one entity to another we use a foreign key,  This is the primary key from the entity whose relationship is one, in the table whose relationship is many WARDPATIENT holds wardID patientID wardID

Quick Exercise 1)Produce attribute tables for the relationship between customer and Videos in a rental shop. VIDEO VIDEO / RENTAL GENRE PRICE BAND CERTIFCATE CUSTOMER RENTAL

EntityAttributeKeyData TypeSize VideoVideoID Title GenreID CertificateID PriceBandID PK FK Autonumber Text Number 100 chars Integer PriceBandPriceBandID PricePerDay PKAutonumber Currency CertificateCertificateID Certificate PKAutonumber Text3 chars GenreGenreID Genre PKAutonumber Text20 chars Video/RentalVideoID RentalID FK Number Integer RentalRentalID customerID startDate finishDate PK FK Autonumber Number Date/time Integer Short date CustomercustomerID firstName surName Address#1 etc PKAutonumber Text 25 chars 30 chars

Drawing Diagrams Steps to draw an ERD: Read through the scenario and identify the main entities – (these should be the same as the data stores on the level 1 DFD) Draw a diagram linking the entities together, Resolve any many to many relationships, Think about any further entities which may exist – remember the diagram is for the new system so new entities are allowed, Fully describe each entity and its relationship within the diagram Produce an attribute table to show the attributes for each entity

Example Draw an ERD and Produce supporting documentation for this scenario: An insurance company system takes details from customers which includes personal, car and past claim data. The information acquired is complied and pasted onto an external broker which generates quotes. On return from the broker the best quote is formatted appropriately and sent to the customer. Answer

Exercise Draw an ERD and Produce supporting documentation for this scenario: The university and college admission system (UCAS) handles applications to higher education by students in the UK. Students submit data to the system which includes personal details, estimated grades, courses and institutions they want to apply for and a personal statement. A tutor also submits a reference for each student into the system. The system compiles each students application and forwards it onto the institution applied for. Upon receipt the staff at the university scrutinise the application and return to UCAS an offer or rejection – this is then passed onto the student.

Assignment Link By next lesson produce an ERD and supporting documentation for KASBAH NEWS’ New System. You need: A complete ERD Description of the entities Attribute table