BIS 360 – Lecture Six (Part 2) Conceptual Data Modeling (Chapter 10 and partial Chapter 12)
1. Determine system requirements (ch. 7) 2. Structure system requirements (ch. 8-10) 3. Generate alternative for selection (ch. 11) SDLC Where are we? Project ID and Selection Project Initiation & Planning Analysis Logical Design Physical Design Implementation Maintenance Data Modeling Processing Modeling Logic Modeling
Differences between Modeling Data Modeling - Using Entity-Relationship Diagram (ER diagram or ERD) –identify What (types of data) needed in the system Process Modeling - Using Data Flow Diagram (DFD) –identify Where and How (which pieces of data) to be used Logic Modeling - Using Structured English, Decision Table, and Decision Tree –detail System Logic and Functional Structure
ERD and DFD Data Model (ER Diagram) Data Modeling (ER Diagramming) Process Modeling (Data Flow Diagramming) Process Model (Data Flow Diagram) (more static) (more dynamic)
Some Basic Jargons Model: An abstract representation of “reality” Data Model: An organization of data to represent the “reality.” Data Modeling: a technique used to create a “Data Model.” Conceptual Data Modeling: a technique to capture both “data” and its “meaning” required by an organization
Conceptual Data Modeling It is: presenting what data are needed in the system independent from “how” data are stored Independent from which DBMS to be used Its deliverables: A preliminary ER model (address only Entities and Relationships) A refined ER diagram (with detailed attributes for each entity)
An Example -- A Preliminary Entity-Relationship Model
An Example -- A Refined Entity-Relationship Diagram
ERD - basic concepts Entity A thing (tangible/intangible) that can be uniquely identified -- indicated by a noun, it could be a(n): –Person –Object (e.g., machine, tool, equipment, document) –Concept (e.g., position, movie, etc.) Symbol: a symbol for an Entity
ERD - basic concepts Relationship: An association between one or more entities -- described by a verb phrase; it is bi-directional Symbol: A Line (with Crow’s foot)
Entity Type - the object set that shares a common group of characteristics, e.g., STUDENT (SID, Name, Phone, Major) Entity instance - an occurrence of an Entity Type, e.g., (1234, Mike Taylor, , CIS) ERD - basic concepts Entity Type vs. Entity Instance
ERD - Extended Concepts Associative Entity: a special relationship that contains its characteristics to associate instances of one or more entity types. Symbol: EMPLOYEECOURSE completes Date
Weak Entity: an “entity” depends on another entity for its existence. Symbol: Weak Entity EMPLOYEE SPOUSE ERD - Extended Concepts
How to Characterize a Relationship? Cardinality: The number of occurrences (instances) involved at each side of a relationship –zero or One –one and only one –zero or many –one or many (Optional one) (Mandatory one) (Optional Many) (Mandatory Many)
Relationship: Extended Concepts Degree of a Relationship: The number of entity types involved in a relationship. Unary - a R within an entity itself Binary - a R between two different entity types Ternary - a R exists among three entity types
1 to 1 (1:1) 1 to many (1:M) many to many (M:N) Binary Relationships EmployeeSpouse is a spouse of has Vehicle Type Model is of registers Course is registered by Student is married to
Unary Relationships Person is a spouse of is married to 1 to 1 manages 1 to M Employee is managed by consists of M to N Part is a component of
Unary Relationships (a complete graph) Person is a spouse of is married to 1 to 1 consists of M to N Part is a component of is managed by 1 to M Employee manages
Unary Relationships Each Employee may manage one or more Employees. Each Employee must be managed by one and only one Employee. manages is manages by 1 to M Employee
More Unary Relationship! Course has a prerequisite is a prerequisite of Q. What is the cardinality for the above unary relationship?
More Unary Relationship! (A complete graph) Course has a prerequisite is a prerequisite of Why? Can you explain the above diagram?
Ternary Relationship A relationship that simultaneously involves 3 entities!
How to Characterize an Entity? Attribute A characteristic (property) of an entity or a relationship –Key (identifier) –Candidate key –Non-key attribute Examples: EMP (EmpID, Name, Address, DOB) DEPT (DeptID, DeptName, DeptAddress)
Foreign Key Foreign key: It is an attribute ( or a set of attributes) that is used as a Primary Key in some other entity. EMPDEPT EMP (EmpID, Name, Address, DOB) DEPT (DeptID, DeptName, DeptAddress)
How to Resolve a M:N Relationship? It is quite common to encounter a M:N relationship - which needs to be represented as an “Associative entity”. Most DBMS can not represent a M:N relationship, we need to... Use the two PKs as the PK and FKs in the associative entity Sup_PART SUPPLIERPART SID PID
An Example for an M:N Relationship Associative Entity SUPPLIER(SID, Name, SSN, Phone, Addr) PART (PID, Description) SUPPLIER SID NameSSNPhone Addr PART PID Descrip Associative Entity Price Sup_PART (SID, PID, Price)
How to Conduct the ER Diagramming? Step 1 - Identify all interested Entities Step 2 - Identify proper relationships between entities Step 3 - identify the Key and non-key attributes for each entity Step 4 - Verify the validity of the final ER diagram
Validation of ERD Rules: The entity name must be a noun The entity name must be unique The entity must have an identification or primary key Each relationship is described by a verb (phrase)