MSc IT UFIE8K-15-M Data Management Prakash Chatterjee Room 3P16

Slides:



Advertisements
Similar presentations
Chapter # 4 BIS Database Systems
Advertisements

Database Design: ER Modelling (Continued)
Lecture 6 : Normalisation
Database Design Process
© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
Lecture plan Outline of DB design process Entity-relationship model
MSc IT UFCE8K-15-M Data Management Prakash Chatterjee Room 2Q18
MSc IT UFIE8K-15-M Data Management Prakash Chatterjee Room 2P21
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
CSC271 Database Systems Lecture # 22. Summary: Previous Lecture  Applying Database SDLC on DreamHome  Database planning  System definition  Requirements.
ISMT221 Information Systems Analysis and Design Entity-Relationship Diagram Lab 4 Tony Tam.
System Analysis - Data Modeling
Concepts of Database Management Seventh Edition
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
APPENDIX C DESIGNING DATABASES
MIS2502: Data Analytics Relational Data Modeling
Entity-Relationship Design
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
File and Database Design SYS364. Today’s Agenda WHTSA DBMS, RDBMS, SQL A place for everything and everything in its place. Entity Relationship Diagrams.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Business Process Modeling
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Chapter 5 Entity–Relationship Modeling
Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model.
The Relational Database Model
MSc IT UFIE8K-15-M Data Management Prakash Chatterjee Room 3P16
1.  An introduction to data modelling  The purpose of data modelling  Modelling data relationships 2.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
1 Entity-Relationship Diagram. 2 Components of ERD: –Entity –Relationship –Cardinality –Attributes.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
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.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Information Access Mgt09/12/971 Entity-Relationship Design Information Level Design.
MIS2502: Data Analytics Relational Data Modeling
UFCEUS-20-2 : Web Programming
Methodology - Logical Database Design. 2 Step 2 Build and Validate Local Logical Data Model To build a local logical data model from a local conceptual.
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
COP Introduction to Database Structures
Database Design Chapters 17 and 18.
Lecture 3 : Structured Query Language (SQL)
Databases Chapter 9 Asfia Rahman.
MIS2502: Data Analytics Relational Data Modeling
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Entity-Relationship Model
Tables and Their Characteristics
Lecture 2 The Relational Model
ERD’s REVIEW DBS201.
Entity Relationship Diagrams
MIS2502: Data Analytics Relational Data Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
MIS2502: Data Analytics Relational Data Modeling
Lecture 16 : The Relational Data Model
DCT 2053 DATABASE CONCEPT Chapter 2.2 CONTINUE
Lecture 16 : The Relational Data Model
MIS2502: Data Analytics Relational Data Modeling 2
Presentation transcript:

MSc IT UFIE8K-15-M Data Management Prakash Chatterjee Room 3P Lecture 5 : Data Modelling (2) : the Entity-Relationship Approach

UFIE8K-15-M Data Management 2010/112 E-R modelling concepts (1) Entity & Attribute An entity is anything relevant to the Universe of Discourse (UoD) or domain. It can be defined as a group of logically associated data items identified by a unique key. ‘Entity type’ is used to describe all entities relevant to the domain which fit a given definition. Entity typeEntity occurrence PersonDavid Beckham, Miss Dynamite BuildingBuckingham Palace, Mansion House CarX723 LSO, S234 TJH

UFIE8K-15-M Data Management 2010/113 E-R modelling concepts (2) Identifying entities This can be a difficult task. The analyst must gain a thorough understanding of the system environment. The entities could come to light, for example, from the dataflow diagrams produced during systems investigation. Another method is to find the things in the environment which need to be individually identified and referred to. Notional keys can be used to identify a range of other data - for example, a customer number identifies customer name and address, class, credit limit etc, which leads us to identify the CUSTOMER entity. Examples of notional keys could include: Customer number Product code Job number Account number.

UFIE8K-15-M Data Management 2010/114 E-R modelling concepts (3) Attributes An attribute is a property or characteristic of an entity about which there is a need to record data; it is the named column of a relation. The attribute type is the collection of all values of a defined property associated with a given entity type. Entity typeAttribute typeAttribute occurrence Personname D. 0. B. sex John Smith male Buildingaddress annual rent 6 High Road f90 per sq. metre Note: there is no absolute distinction between entity type and attribute type - an attribute type in one context can be an entity type in another. For example, to a car manufacturer, COLOUR is an attribute of the entity type CAR; to a paint manufacturer, COLOUR may well be an entity type.

UFIE8K-15-M Data Management 2010/115 E-R modelling concepts (4) Null values A special value called the null value may be created when there is no value for an attribute. Null can be used for one of two reasons: either an entry is not applicable or it is not known. - An example of 'not applicable' would be the attribute Flat Number of an Address: this applies only to those people who live in flats; the Flat Number attribute would be null for those people who live in houses - An example of 'not known' would be the Height attribute of a Person being recorded as null if the height is unknown. When a table is implemented (using SQL), nulls are treated in a special way - as nulls rather than 'spaces' or zero. They are either displayed empty, or, if part of a calculated column, the whole record is excluded from the query, since it is not possible to determine the result of a calculation with null.

UFIE8K-15-M Data Management 2010/116 E-R modelling concepts (5) Relationships A relationship is an association between entities that is operationally significant to the domain. EntityRelationshipEntity At University of the West the of EnglandSTUDENTS SCHOOLS take COURSES haveSTAFF At Ford Motor CorporationASSEMBLIES STAFF havePARTS work onCONTRACTS

UFIE8K-15-M Data Management 2010/117 E-R modelling concepts (6) The entity-relationship (E-R) diagram Entities and relationships can be used to produce a pictorial representation of the UoD. This picture is called an entity-relationship diagram. The figure on the next slide shows an entity-relationship diagram for the following scenario: “A University Library keeps information on books held, students who borrow these books and the loans which the students make. In addition, information is held about the authors and publishers of these books. A database designer has established the entities and attributes needed to carry out typical library functions and has produced the following entity-relationship diagram.”

UFIE8K-15-M Data Management 2010/118 E-R modelling concepts (7) An University Library System E-R diagram:

UFIE8K-15-M Data Management 2010/119 E-R modelling concepts (8) E-R Diagramming Notation Note that, traditionally, entity names are in the singular form Rectangles are used to denote entity types (named normally as a noun) and lines represent relationship types The lines are labelled with the names of the relationship (normally as a verb) The arrow symbol indicates the correct direction for the name of the relationship to make sense. For example, a student makes many loan records. This diagram uses the unified modelling language (UML) notation for the entity-relationship diagram – there are a number of other notations also used (e.g. Chen’s “crows-feet” notation).

UFIE8K-15-M Data Management 2010/1110 E-R modelling concepts (9) Notes on the diagram: Note that the Book-Copy table holds information on the physical books stored in the library whereas the Book-Title table holds information on a particular publication of a book. a book which is still out on loan will have a blank date-back field in the loan table As copies of books become old, damaged and dirty, the books are removed from the library and destroyed. Destroyed book copies have a date to indicate this, otherwise the date is null. The diagram also shows the maximum and minimum times that an entity occurrence can exist in a relationship. For example, a student can borrow zero or more books. This is called an optional relationship: occurrences of an entity (student) can exist independently of the loan entity. Otherwise, the relationship is mandatory: every occurrence of an entity participates in the relationship. In the book-title/authorship relationship, a title cannot exist without at least one author. The notation used will be explained more fully in the next section. An E- R diagram is drawn because: - By analysing the entities and relationships of an UoD, many hundreds of entities may be identified. The data model provides a concise summary of the results of the analysis - The E-R diagram will be used as the basis of database design. The structure of the model will be mapped onto the logical structure of the database.

UFIE8K-15-M Data Management 2010/1111 E-R modelling concepts (10) An E-R diagram of a Chess League (using the OMT notation):

UFIE8K-15-M Data Management 2010/1112 E-R modelling concepts (11) The cardinality of a relationship There are several relationship types: One-to-one relationships One-to-many relationships Many-to-many relationships Recursive (or involute) relationships

UFIE8K-15-M Data Management 2010/1113 E-R modelling concepts (12) One-to-one relationship In a 1-to-1 relationship, an occurrence of the first entity type is related to a maximum of one occurrence of the second entity type, and each occurrence of the second type to a maximum of one of the first. One member of parliament is elected to one constituency; one constituency has one MP elected to it.

UFIE8K-15-M Data Management 2010/1114 E-R modelling concepts (13) One-to-many relationship In a 1-to-m relationship, an occurrence of the first entity type may be related to several occurrences of the second, but each occurrence of the second is related to a maximum of one occurrence of the first. One customer places zero or more orders; one order is placed by one customer.

UFIE8K-15-M Data Management 2010/1115 E-R modelling concepts (14) Many-to-many relationship In a m-to-m relationship, an occurrence of the first entity type may be related to several occurrences of the second and vice versa. One depot holds zero or more products; one product is held at 1 or more depots.

UFIE8K-15-M Data Management 2010/1116 E-R modelling concepts (15) Recursive (or involute) relationship In a recursive relationship, entity occurrences relate to other occurrences of the same entity. One employee (a manager) manages one to twenty employees; one employee is managed by one employee (manager).

UFIE8K-15-M Data Management 2010/1117 E-R modelling concepts (16) Decomposition All many-to-many relationships, can be decomposed into two one- to-many relationships. One reason for doing this is that relational DBMSs do not support many-to-many relationships directly. Also, by eliminating many-to-many relationships, problems in the model become easier to spot.

UFIE8K-15-M Data Management 2010/1118 E-R modelling concepts (17) Key attributes It may be necessary to specify one or more of the attributes of an entity as a 'key' of the entity. This is particularly true of the relational model. Three types of keys are defined here: A candidate key is a unique identifier for the entity - there may be more than one candidate key (for example, customer-no, customer address) A primary key (Pk) is also a unique identifier for the entity - that is, an attribute (or combination of attributes) with the property that, at any given time, no two entity occurrences contain the same values for that attribute (or combination of attributes). One candidate key is chosen as the primary key. (Between the two candidate keys mentioned above it is likely that customer-no would be chosen as the primary key as this is more likely to be unique.) A foreign key (Fk) is an attribute in a relation which is also the primary key in another relation.

UFIE8K-15-M Data Management 2010/1119 Bibliography / Readings / Home based activities Bibliography - An Introduction to Database Systems (8 th ed.), C J Date, Addison Wesley 2004 An Introduction to Database Systems - Database Management Systems, P Ward & G Defoulas, Thomson 2006 Database Management Systems - Database Systems Concepts (4 th ed.), A Silberschatz, H F Korth & S Sudarshan, McGraw-Hill 2002 Readings - Introduction to SQL’ McGraw-Hill/Osbourne (handout) Home based activities - Ensure you download xampp and install on home PC or laptop (if you have a slow home internet connection – download to data key or CD here at UWE) - Copy the SQL Workbook onto your data key or CD. - Import the tables from the SQL Workbook into your home MySQL DB. Begin working through some of the query examples in the workbook using PHPMyAdmin.