![Page 1: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/1.jpg)
1
MIS 340:Data Modeling 2
Yong Choi
School of Business
CSUB
![Page 2: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/2.jpg)
Entities???• Made up for the class…….ambiguous…
ANG Laboratory has several chemists who work on one or more projects. Chemists also may use certain kinds of equipment on each project. The organization would like to store the chemist’s employee identification number, his/her name, up to three phone numbers, his/her project identification number and the date on which the project started. Every piece of equipment, the chemist uses, has a serial number and a cost.
![Page 3: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/3.jpg)
Entities
Chemist
Project
Equipment
![Page 4: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/4.jpg)
Entities’ Attributes???
ANG Laboratory has several chemists who work on one or more projects. Chemists also may use certain kinds of equipment on each project. The organization would like to store the chemist’s employee identification number, his/her name, up to three phone numbers, his/her project identification number and the date on which the project started. Every piece of equipment, the chemist uses, has a serial number and a cost.
![Page 5: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/5.jpg)
5
entities, attributes and identifiers
Project
Proj#Start-Date
Chemist
Phone#Emp#
EquipmentSerial#
cost
![Page 6: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/6.jpg)
6
How to find relationships?
• Relationship: – Association between entities– Two entities can have more than one type of relationship
– look for a verb or a verb phrase between entities– A couple of sentences to describe a relationship between two
entities.
![Page 7: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/7.jpg)
More about Relationship• Usually, a relationship can be described by a couple of
sentences between two entities.• Operate in both directions– Relationship between Student and Curriculum
• A student is enrolled in many curriculums.• Each curriculum is being studied by many students.
![Page 8: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/8.jpg)
Relationships ???
ANG Laboratory has several chemists who work on one or more projects. Chemists also may use certain kinds of equipment on each project. The organization would like to store the chemist’s employee identification number, his/her name, up to three phone numbers, his/her project identification number and the date on which the project started. Every piece of equipment, the chemist uses, has a serial number and a cost.
![Page 9: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/9.jpg)
Entities/Relationships& their Attributes
Chemist
Phone#
Project
Proj#Start-Date
Equipment
Works-On
Uses
Date-Assigned
Emp#
Serial#
cost
Assign-Date
![Page 10: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/10.jpg)
Steps for creating an ERD• Identify the entities
– Beginner: look for nouns• Identify the attributes
– Beginner: look for entity descriptions• Identify the relationships
– Beginner: look for a verb or a verb phrase between entities
![Page 11: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/11.jpg)
Degree of Relationship
• Degree of a Relationship describes the number of entity participation – Unary (Recursive) Relationship: One instance
related to another of the same entity type– Binary Relationship: Instances of two different
entities related to each other– Ternary Relationship: Instances of three
different types related to each other
![Page 12: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/12.jpg)
Degree of Relationship …
![Page 13: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/13.jpg)
Type of Relationships (Cardinality)• One – to – One (1:1)
– Each instance in the relationship will have exactly one related member on the other side
• One – to – Many (1:M)– A instance on one side of the relationship can have many
related members on the other side, but a member on the other side will have a maximum of one related instance
• Many – to – Many (M:N)– Instances on both sides of the relationship can have many
related instances on the other side
![Page 14: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/14.jpg)
1:1 relationship in Set notation
DEPARTMT EMPLOYEE
![Page 15: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/15.jpg)
Example of 1:1 relationship
• A one-to-one (1:1) relationship is when at most one instance of an entity A is associated with one instance of entity B.– Each employee is assigned to one workstation. – Not all workstations are assigned to employees.
![Page 16: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/16.jpg)
1:M relationship in Set notation
DEPARTMT EMPLOYEE
![Page 17: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/17.jpg)
Example of 1:M relationship
• A one-to-many (1:N) relationships is when for one instance of entity A, there are zero, one, or many instances of entity B, but for one instance of entity B, there is only one instance of entity A.– A department is responsible for many projects. – Each project is the responsibility of one department.
![Page 18: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/18.jpg)
M:N relationship in Set notation
WAREHOUSE PRODUCT
![Page 19: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/19.jpg)
Example of M:N relationship
• A many-to-many (M:N) relationship, sometimes called non-specific, is when for one instance of entity A, there are zero, one, or many instances of entity B and for one instance of entity B there are zero, one, or many instances of entity A. – Employees are assigned to many projects. – Every project has assigned at least one employee.
![Page 20: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/20.jpg)
20
Type of Relationship (Cardinality)The organization would like to store the date the chemist was assigned to the project and the date an equipment item was assigned to a particular chemist working on a particular project. A chemist must be assigned at least to one (or more) project and one (or more) equipment. Projects and equipments must be managed by only one chemist. A given project need not be assigned an equipment.
![Page 21: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/21.jpg)
Complete ER Diagram
Chemist
Phone#
Project
Proj#Start-Date
Equipment
Works-On
Uses
Date-Assigned
N1
N1
Emp#
Serial#
cost
Assign-Date
![Page 22: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/22.jpg)
Steps for creating an ERD• Find out candidate entities• Identify the entities • Identify the attributes • Identify the relationships
– Beginner: look for participation related words and phrases such as zero, none, a, one, several, many…..
– Optional relationship: look for auxiliary verbs such as may, might, can and based upon own judgment..)
• Finalize business rules
![Page 23: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/23.jpg)
Original IE Notations(minor differences with the textbook – pp.223)
• 1-to-1 relationship
• 1-to-M relationship
• M-to-N relationship
• weak entity relationship
• optional relationship
• recursive relationship
Employee
![Page 24: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/24.jpg)
Type Minimum Instances
Maximum Instances
Graphic Notation
Exactly one
Zero or one
One or many
Zero or many
1
1
0
0
1
1
Many (>1)
Many (>1)
![Page 25: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/25.jpg)
1:1 relationship
A person must have one and only one DNA pattern and that pattern must be applied to one and only one person.
![Page 26: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/26.jpg)
1:1 with optional relationship (OR)on one side
A person might not or might be a programmer, but a programmer must be a person.
![Page 27: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/27.jpg)
1:M relationship
Each department hires many employees, and each employee is hired by one department.
EMPLOYEEDEPARTMTHIRES
IS_HIRED_BY
![Page 28: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/28.jpg)
1:M with OR on many side A person might be a member or might not, but could be
found multiple times (if the member entity represents membership in multiple clubs, for instance). A member must have only a single person.
![Page 29: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/29.jpg)
1:M with OR on both side A person might have no phone, one phone or lots of
phones, and that a phone might be un-owned or can only be owned by a person.
![Page 30: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/30.jpg)
M:N relationshipEach student takes many classes, and a class must be taken by many students.
** Many-to-many relationships cannot be used in the data model because they cannot be represented by the relational model (see the next slide for the reason) **
STUDENTCLASSTAKE
IS_TAKEN_BY
![Page 31: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/31.jpg)
Example of M:N
Many-to-many relationships is a second sign of complex data.
When x relates to many y's and y relates to many x's, it is a many-to-many relationship.
In our example schema, a color swatch can relate to many types of sweaters and a type of sweater can have many color swatches.
![Page 32: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/32.jpg)
Example M:N Relationship
3 to 330 to 30
300 to 3003000 to 3000
30,000 to 30,000300, 000 to 300, 000
Table to represent Entity
![Page 33: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/33.jpg)
Transformation of M:N1. When transform to relational model, many
redundancies can be generated.– The relational operations become very complex and are likely
to cause system efficiency errors and output errors. – Break the M:N down into 1:N and N:1 relationships using
bridge entity (weak entity).
CLASS STUDENTENROLL
![Page 34: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/34.jpg)
Weak Entity relationship
• A weak entity is an entity that cannot be uniquely identified and existed by itself alone.
• Thus, a weak entity is an entity that exists only if it is related to a set of uniquely determined entities (owners of the weak entity). – More examples on the textbook
• Each employee might have none or multiple dependents. However, dependents must belong to at least one employee.
EMP DEP
weak entity notation
![Page 35: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/35.jpg)
Converting M:N Relationship to Two 1:M Relationships
Bridge Entity
![Page 36: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/36.jpg)
Bridge Entity
• ENROLL entity becomes a weak entity of both STUDENT entity and CLASS entity
• MUST have a composite (unique) identifier STU_NUM (from STUDENT entity) and CLASS_CODE
(from CLASS entity)
![Page 37: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/37.jpg)
M:N with optionality on both side
• A person might or might not work for an employer, but could certainly moonlight for multiple companies. An employer might have no employees, but could have any number of them.
After broken down, optional relationship notation on both side of associative entity
![Page 38: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/38.jpg)
Recursive relationship 1
• A recursive relationship is an entity is associated with itself.
• Each employee is supervised directly by at most one supervisor (manager). Each supervisor (manager) can manage many employees.
Employee
manages
is managed by
![Page 39: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/39.jpg)
Recursive relationship 2
• Each student is taught by a STA (student teaching assistant). Each STA can teach several students.
Student
teaches
is taught by
![Page 40: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/40.jpg)
Data Modeling Errors
• In general, there are two classes of E-R modeling errors that lead to normalization problems: – Incomplete data model error– Miss-modeled problem domain error
• Read next two slides…
![Page 41: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/41.jpg)
In Complete Data Model
• Occur in situations where the systems analysts is tasked to build a computer-based information system that is limited in scope. A key objective for successful information system project management is the definition of a limited, yet adequate project scope--a scope that enables the production of system deliverables within a reasonable time period. Limiting a project's scope often results in information systems that are based on limited data models. Limited information systems are fairly common throughout the IS world where dissimilar technologies prevent data sharing and work against the concept of a shared, enterprise-wide database.
![Page 42: 1 MIS 340: Data Modeling 2 Yong Choi School of Business CSUB](https://reader035.vdocuments.site/reader035/viewer/2022062313/56649d455503460f94a22625/html5/thumbnails/42.jpg)
Miss-modeled problem domain error
• The miss-modeled problem domain error is actually a class of errors including those that arise whenever systems analysts lack a complete understanding of the problem domain. These include errors such as depicting an attribute as single-valued when, in fact, the attribute is multi-valued, or depicting a single entity which includes attributes that should be assigned to two separate entities, or miss-modeling the connectivity or degree of a relationship.