Fundamentals/ICY: Databases 2010/11 WEEK 5 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.

Slides:



Advertisements
Similar presentations
Chapter # 4 BIS Database Systems
Advertisements

Entity Relationship (E-R) Modeling Hachim Haddouti
Entity Relationship (ER) Modeling
Chapter 4 Entity Relationship (E-R) Modeling
4 4 Chapter 4 Entity Relationship (E-R) Modeling Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Fundamentals/ICY: Databases 2013/14 Week 6: Monday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Chapter 4 Entity Relationship (E-R) Modeling
Entity Relationship (ER) Modeling
Entity Relationship (ER) Modeling
Entity Relationship (E-R) Modeling
LIS 557 Database Design and Management William Voon Michael Cole Spring '04.
Database Systems: Design, Implementation, & Management, 5 th Edition, Rob & Coronel 1 Data Models: Degrees of Data Abstraction l Modified ANSI/SPARC Framework.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Entity Relationship (E-R) Modeling
BTM 382 Database Management Chapter 4: Entity Relationship (ER) Modeling Chitu Okoli Associate Professor in Business Technology Management John Molson.
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
3 Chapter 3 Entity Relationship (E-R) Modeling Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
ITEC 3220M Using and Designing Database Systems Instructor: Prof. Z.Yang Course Website: 3220m.htm
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Chapter 5 Entity Relationship (ER) Modelling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Fundamentals/ICY: Databases 2012/13 WEEK 5 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Fundamentals/ICY: Databases 2012/13 WEEK 7 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK.
Fundamentals/ICY: Databases 2013/14 Week 10 –Monday –Normalization, contd John Barnden Professor of Artificial Intelligence School of Computer Science.
Database Design Principles – Lecture 3
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 
Fundamentals/ICY: Databases 2012/13 WEEK 11 – 4 th Normal Form (optional material) John Barnden Professor of Artificial Intelligence School of Computer.
4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Relationship Degree Indicates number of entities or participants.
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Data Modeling Using the Entity-Relationship (ER) Model.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
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.
Database Design – Lecture 4 Conceptual Data Modeling.
Fundamentals/ICY: Databases 2013/14 WEEK 9 –Friday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
advanced data modeling
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
Fundamentals/ICY: Databases 2013/14 Week 4: Friday John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham,
Fundamentals/ICY: Databases 2013/14 Week 11 – Monday – relations, ended. John Barnden Professor of Artificial Intelligence School of Computer Science University.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
Entity Relationship Modeling
Entity Relationship (E-R) Model
Entity Relationship Modeling
TMC2034 Database Concept and Design
Chen’s Type Guidance.
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Fundamentals/ICY: Databases 2010/11 WEEK 6
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 4 Entity Relationship (ER) Modeling
Entity-Relationship Diagram (ERD)
Fundamentals/ICY: Databases 2013/14 WEEK 6 - Friday
Entity Relationship (ER) Modeling
Chapter # 4 Entity Relationship (ER) Modeling.
Presentation transcript:

Fundamentals/ICY: Databases 2010/11 WEEK 5 John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK

Reminder of Week 4

Mental Exercises for You uWhat about the Employments bridging type we introduced? uOne entity type can be existence-dependent on another without therefore being weak. Why?

New for Week 5

Entity Relationship (ER) Model(s) and Diagrams

Rob, Coronel & Crockett Database Systems: Design, Implementation, and Management, (2008) Uses different diagrams from main book and my slides! More like the notation in the Additional Notes

The Entity Relationship Model uIntroduced by Chen in 1976 uMost widely used “conceptual model” of DBs. u“The ER model” : general meaning = just the idea of thinking of things as composed of entities, attributes and relationships. uWe also say that applying this approach in a particular case gives rise to an “ER model” of the specific environment of interest. uDiagrams based on the/a model are a widely accepted and adopted graphical approach to database design. / uThe/an ER model has nothing intrinsically to do with diagrams!!! Let alone any specific sort of diagram!!!

A Conceptual Model / uER model that provides high-level, manager/user- friendly view of the database uBasis for identification and description of main data objects and relationships, avoiding details

Entity Relationship Diagrams (ERDs) uAn ER model of an environment forms the basis of an ER diagram (ERD) or several ERDs. uThere are several markedly different styles of ERD, and for each main style there are several variants. l And the style in the module handouts will differ somewhat from that in the textbooks and these lectures uAn ERD depicts (some of) the ER model’s entity types, attributes and relationships, and (depending on the diagram style) varying amounts of other info such as connectivities, cardinalities, keys, weakness, …

Quick Flavour of Two Styles of Diagram

The Completed Tiny College ERD

Relationships: The Basic Chen ERD-let

Relationships: The Basic Crow’s Foot ERD-let

Caution uIn previous two diagrams, each relationship was mandatory in both directions. uBut saying “1:1”, “1:M” or “M:N” does not of itself imply mandatoriness in either direction. In particular, don’t be deceived by the “1” here – it’s not a minimum. uWe will see in a minute how to draw optional (non- mandatory) relationships.

A Model for Tiny College

1:1 Relationship Between PROFESSOR and DEPARTMENT (mandatory in both directions)

Tables for that 1:1 Relationship

1:M Relationship Between PAINTER and PAINTING (mandatory in both directions)

Tables for that 1:M Relationship

The M:N Relationship uCan be implemented by breaking it up to produce two 1:M relationships uCan avoid problems inherent to M:N relationship by creating a composite entity or bridge entity

M:N Relationship between STUDENT and CLASS (both ways mandatory): preliminary ERD (conceptual level)

Conversion to Two 1:M Relationships (towards “logical” level)

A Bridge (or Composite) Entity Type uIts table is called a linking table (or bridging table) uIts primary key is composed of the primary keys of each of the entity types to be connected uThose keys are also foreign keys in the bridge type uLinking table may contain multiple occurrences of each foreign key value uMay also contain additional attributes that play no role in the bridging as such

Direct Impln of M:N Relationship between STUDENT and CLASS

Converting the M:N Relationship into Two 1:M Relationships

Connectivity and Cardinality in an ERD

Relationship Participation uOptional [in a particular direction, X to Y]: l an X entity occurrence does not require a corresponding Y entity occurrence l i.e. the minimum number of Ys per X is 0 uMandatory [in a particular direction, X to Y]: l an X entity occurrence requires a corresponding Y entity occurrence l i.e. the minimum number of Ys per X is 1 or more

Drawing Optionality NOTE: the dashing of the line is NOT because of the optionality, but because of weakness

1:M Relationship, Mandatory Both Ways NOTE: error in top diagram – what??

An M:N Case NOTE: error in top diagram – what??

The Chen Representation of the Invoicing Problem

The Crow’s Foot Representation of the Invoicing Problem

The Attributes of the STUDENT Entity

Derived Attributes uAttribute whose value may be calculated (derived) from other attributes uNeed not be physically stored within the database uCan be derived by using an algorithm

Depiction of a Derived Attribute

Attributes

Weak Entity Types in ERDs

Weak Entity Types uWeak entity type W meets two conditions (as clarified by J.A.B.): l Existence-dependent on some other entity type X via some relationship R: An entity of type W cannot exist as such without being in relationship R to an entity of type X l Has primary key that is partially or totally derived from the primary key of X uDatabase designer usually determines whether an entity can be described as weak based on the business rules

A Weak Entity in an ERD

A Weak (Non-Identifying) Relationship

Multivalued Attributes in ERMs and ERDs (now with more explanation)

A Multivalued Attribute in an Entity: CAR_COLOR gives multiple colours

Multivalued Attributes u“You should not implement them in the relational DBMS” [rather, you should re-represent them in a special way – J.A.B.] uOne possibility: Use a variable-length string for the attribute, and list all the values within the string. Disadvantage: little support supplied by the DBMS – insertions and deletion require special extra programming. Similarly if calculations are needed on the individual values.

Multivalued Attributes, contd uAnother possibility: Within original entity type, split the attribute into several different attributes corresponding to different natural components of the entity. (See next slide.)

Splitting the Multivalued Attribute into New Naturally Namable Attributes

Multivalued Attributes, contd uDisadvantages: l The attribute may need to be split differently for different entities. l The attribute may not have naturally namable aspects at all. E.g., imagine blotches of colour in random places on a car.

Multivalued Attribute Problems, contd uAnother possibility: Within original entity type, split the attribute into several different attributes not corresponding to specific components of the entity. E.g., have attributes called Colour1, Colour2, …, Colour6. l Advantage: copes with the no-identifiable-components problem and the different-split problems. NB: also allows repetition of colours. l Disadvantages: Have to set aside enough columns to accommodate the conceivable max, but if this max not often approached then have a lot of wasted space. Searching for a colour, or doing insertions and deletions, can be very cumbersome.

Multivalued Attributes, contd uOften Better: Replace the attribute by a new 1:M relationship to a new entity type holding the original attribute’s data. If the components of the original attribute are conceptually distinguishable in a natural way, the new entity can have an attribute whose values identify those components.

So “trim colour” is one of the components of the original multivalued attribute

Multivalued Attributes, contd uIf the original multivalued attribute does not have namable components, leave out the component-naming attribute (COL_SECTION in diagram). l But NB: the PK would then need to include, in our example, the colour. So we can’t have repetitions of colours. uOr include an integer-valued attribute to allow the values to be distinguished. l The PK now includes that attribute. Now we can have repetitions of colours.