Download presentation
Presentation is loading. Please wait.
1
Data Modeling with ERD ISYS 363
2
Entity-Relationship Diagram An entity is a “thing” in the real world, such as a person, place, event for which we intend to collect data. An entity has certain characteristics (properties) known as attributes (fields). Entity type(Entity set): a set of similar entities. A business environment may involve many entity types. –University: Faculty, Student, Course –Department, Employee, Dependent –Sales person, Customer, Order
3
Entity-Relationship Diagram Relationship: Interaction between entity types. –Faculty teach Course, Faculty advise Student –Customer open Account, Customer purchase Product. Binary relationship: A relationship involves two entity types. Three types of binary relationship: –1:1, 1:M, M:M
4
Conceptual Database Design Methodology Identify entity types. Identity relationship types between the entity types. Identify and associate attributes with entity or relationship types. Determine attribute domains. Determine candidate keys and primary key. Validate conceptual model: –Check for redundancy, support required transactions, review the model with user
5
Entity-Relationship Diagram ER modeling begins by identifying the entities and relationships between entities that must be represented in the model. Entities and relationships between entities are represented in a diagram.
6
1:1 Relationship Examples: –Husband, Wife –State, State Governor –Order, Invoice
7
1:M Relationship Examples: –Father, Child –Department, Employee –Customer, Order
8
M:M Relationship Examples: –Boy friend, Girl friend –Bank customer, Bank account –Student, Student organization
9
ERD Notations Student Account Faculty Course Has 11 Enroll MM Advise M 1 Teach M 1
10
Attributes Properties of an entity or a relationship. Simple attributes –Address:Street address, City, State, ZipCode –Street Address: Number, Street, Apt# Single-valued attributes Derived attributes Primary key
11
Student SID Fname Lname DateOfBirth Age
12
Domains of Attributes The set of allowable values for one or more attributes. Input validation Examples: –Sex: F, M –EmpHourlyWage: Between 6 and 300 –EmpName: 50 charcters
13
Introduction to Relational Database Data is logically structured within relations. Each relation is a table (file) with named columns (attributes, fields) and rows (records).
14
Properties of a Relation Simple attribute –No composite, no multivalued attribute Each relation must have a primary key: –Simple or composite key –May have other keys (candidate keys) –Key cannot be null –Cannot be duplicated
15
Relational Database Design Create a table for each entity that includes all simple attributes Relationship: –1:1, 1:M Relationship table Foreign key –M:M: relationship table
16
Database Design Example Be able to answer questions University: –1:1 Relationship: Student and Account –What is Peter’s account balance –Find students that owe more than 2000 dollars. –1:M Relationship Faculty Advisor and student –Who is Peter’s advisor? –How many students advised by Chao? –M:M Relationship Student and course –How many units Peter takes? –Find students that are taking 363.
17
Database Design Example Bank: –Customer, Account, bank employee
18
Database Design Example Order Processing: –Customer, Order, Product
19
Advanced Topics Composite attribute Composite key Multivalued attribute –Student’s Major attribute –Faculty’s DegreeEarned attribute –Vehicle’s Color attribute –Others: PhoneNumber, EmailAddress –Create a table for each multi-valued attribute –Key + attribute Attributes on a relation
20
Attributes on Relationship Examples: –Student/Course: Grade –Order/Product: Quantity –Product/Country: Date, Quantity
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.