0% found this document useful (0 votes)
13 views35 pages

ER Diagrams for Conceptual Modeling

ER diagrams can be used to model entities, relationships, and attributes in conceptual database design. Entities are represented by rectangles, relationships by diamonds, and attributes by ovals. The diagrams also use symbols to represent identifying relationships, weak entities, cardinality constraints, and other aspects of the conceptual design.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views35 pages

ER Diagrams for Conceptual Modeling

ER diagrams can be used to model entities, relationships, and attributes in conceptual database design. Entities are represented by rectangles, relationships by diamonds, and attributes by ovals. The diagrams also use symbols to represent identifying relationships, weak entities, cardinality constraints, and other aspects of the conceptual design.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Conceptual Modeling with ER Diagrams

Peter Chen introduced ER Diagrams

E-R Modeling
E-R Modeling is a design methodology for modeling the
Entities Relationships

using a diagram with specified shapes for entities, relationships, roles of entities in these relationships, and cardinality.

E-R Diagram Conventions


Symbol Meaning

Entity Type

Weak Entity Type Relationship

Identifying Relationship

Attribute

ER-Diagram Conventions - CONTINUED

Symbol

Meaning Key Attribute

Multivalued Attribute

Composite Attribute

Entities, Relationships and Attributes

A entity is a object or event which needs to be tracked. Attributes characterize entity sets and relationships. Relationships relate two entity sets
Employee SSNum Name

Employee Name

Assigned Date

Project

Payroll Application
A contractor does custom work (projects). He keeps track of employee time for each project. Besides materials, the customer is charged by invoice for employee time on his job. To keep track of employee time, the employee submits a time sheet with entries of project number, hours, description. These are entered into the system along with the employee ID. The hourly rate for the employee is used for each entry to generate a labor charge. The labor charges are totaled for each project and used as a basis for the customer invoice.

Understanding the Requirements


Conference Management End Users

Analysts

Management know high level business rules End users have used paper system or previous software system and have expectations Analysts have understanding of what can / cannot be done and must requirements into system

ER Diagrams for Payroll


Step 1. Identify the Entity Sets with Attributes
Customers : Name, Address,Phone,CustID Projects : Name,Description,ProjID,Total,CustID Employees : Name,SSNo,PayRate,EmpID LaborCharges : EmpID,ProjID,Description,Hours,Amount

ER Diagrams for Payroll


Step 1. Identify Relationships between Entity Sets with any Attributes
Customers Has Project Project is Weak Entity Set Employee Works_On Project Employee Has_Labor_Charge For Project Labor_Charge is Weak Entity Set

E-R Modeling

Entity Sets, Attributes, Relationships


Racquet Club Example

A Racquet Club has members with one year or two year contracts. Members pay contract amount up front, quarterly, or monthly. Members may reserve a court for the next day.

E-R Modeling Entity Sets, Attributes, Relationships Racquet Club Example Continued Entity Sets Members : Name, Start, Contract_Amount, Contract_Period, Initial_Balance, Member_ID Payments : PayerID, Amount, Paid_Date, Payment_ID Reservations : Member_ID, CourtNumber, Hour Relations :
Member - Makes Payment Member - Makes - Reservation

Data Modeling Racquet Club Example

Keys, Cardinality Constraints and Participation Constraints


A key of a relation is a minimal set of attributes and roles which uniquely determine each entity. A cardinality constraint m..n constrains the number of times a single entity can participate in a role of a relationship : m <= times <= n. A participation constraint ensures that an entity will particpate at least this many times.

ER-Diagram Cardinality Conventions


Symbol Meaning Calculated Attribute

Cardinality Constraints

and

Participation Constraints

0 .. *

0 .. 1

1 .. *

1 .. 1

Cardinality and Participation in the E-R model.

1 .. 2 means that at least 1 d must participate in the A relation with C and that not more that 2 ds can participate. If A is represented by a table, then there is at least one row and not more than 2 rows with a single c value.

Many-to-one, one-to-one, and many-to-many correspondences

Cardinality & Participation Constraints

Library Circulation Motel/Hotel Video Store Employment Company

Cardinality & Participation Constraints

Library Circulation Motel/Hotel Video Store Employment Company

Book is_checked_out to Patron Customer rents a room Customer rents a video Applicant is hired for a job

Example of an E-R diagram with an ISA hierarchy.

Using IsA for data partitioning.

New York Customer

Pennsylvania Customer

Participation Constraints
A participation constraint is a lower bound on the number of times an entity can particpate in a relation. Examples: An employee belongs to ONE department. This is a participation and a cardinality constraint 1 .. 1.
Employee 0 .. * 0 .. 1 1 .. * 1 .. 1 Department

Participation constraints.

Relationship Types Two Entity Set Relations


An employee is assigned to at least one project (participation)

Employee

Assigned To Num-Hours

Project

A customer will pay for at least one project Customer Will Pay For Project

Fixed-Cost

Relationship Types One & Three Entity Set Relations

One Set : ReportsTo( SupID, SubID )


subordinate

Employee
supervisor

Reports_To

Three Sets : Sale( ProdID, CustID,SuppID;Date)


Customer
Date

Sold

Product Price

Supplier

ER Diagrams for Payroll


Name Customer Address Has Name Projects ProjID CustID CustID Phone

Description

Total

ER Diagrams for Payroll Name Employee SSNo Has Year TimeSheet

PayRate

EmpID

EmpID

Month

TSID Has TSID Has TSID Labor Charges PayCheck

...
Amount

...
NetPay

The IS-A Relationship


Name Employee SSNo

Is-A

Salaried Employee

disjoint

Hourly Employee

Salary

PayRate

Construct an ER Diagram
Lawn Furniture Manufacturer Stores Information for Catalog of products and parts Stores Information for Manufacturing, including quantity on hand Identify product entities (picnic table and lawn chair) with attributes Identify relationships IsA and PartOf

The Part-Of Relationship


OutDoorProducts IsA Lawn_Chair

Picnic_Table

ProdNo Part_Of

Price

Price

ProdNo

Top

Base Price

Seats ProdNo Quantity

From E-R Diagrams to Relational Database Schema


Converting entities into relations (tables)
Each entity becomes a relation Each attribute of the entity becomes an attribute of that relation (column) If attributes K1 ... Kn form a key of the entity, then K1 ... Kn form a candidate key of the relation.

From ER Diagrams to Relational Database Schema


Translating Entities
Name Type HireDate Employee SSNo Termination

Create Table Employee ( Name char(20), Type char(1), HireDate date, Termination date, SSNo char(9), Primary Key (SSNo) )

From E-R Diagrams to Relational Database Schema


Representing relationships in the database schema
R is a relationship between entity set A and weak entity set B
A becomes a relation with primary key K and B+K becomes a relation with K being a foreign key e.g. employees and dependents

R is a relationship between entity sets A,B and C


A,B and C become relations with KA , KB , and Kc as keys. R becomes a relation with foreign keys KA , KB , and Kc

From ER Diagrams to Relational Database Schema


Translating Relationships
Customer
SaleDate

SaleID Product Price

Sold

Supplier

Create Table Sold ( SaleDate Date, Price Currency, SaleID autonumber, Customer Integer, Supplier Integer, Product Integer, Primary Key (SaleID), Foreign Key ( Customer ) References Customers( CustID), Foreign Key ( Supplier ) References Suppliers( SuppID ), Foreign Key ( Product ) References Products ProdID ) )

Translate into Schema


Name Employee SSNo

Is-A

Salaried Employee

disjoint

Hourly Employee

Salary

PayRate

Translate Into Schema


OutDoorProducts IsA Lawn_Chair

Picnic_Table

ProdNo Part_Of

Price

Price

ProdNo

Top

Base Price

Seats ProdNo Quantity

Common questions

Powered by AI

Participation constraints define the minimum number of times an entity must participate in a relationship. For instance, an employee must belong to one department, which is a participation and cardinality constraint of 1..1 . This affects the E-R model by ensuring certain required relationships are maintained in the database schema.

Multivalued attributes allow an entity to take multiple values for a single attribute, depicted as double ovals in E-R diagrams. In database design, they necessitate creating separate tables to store these multiple values with a foreign key pointing back to the original entity, thereby normalizing the database and ensuring each piece of data resides in its optimal relational structure .

E-R modeling is a design methodology for modeling entities and their relationships. It involves specific shapes used to represent entities, relationships, roles, and cardinalities in a diagram. Entities are objects or events that need tracking, attributes characterize entity sets and relationships, and relationships connect entity sets .

An E-R diagram helps automate payroll by clearly defining entities such as Employees, Projects, and Labor Charges along with their interrelations. It enables the system to systematically track employees' hours on specific projects, compute labor charges based on their rates, and ensure accurate invoicing. This structured mapping facilitates data-driven automation, reducing manual intervention and increasing accuracy and efficiency in payroll management .

Translating E-R diagrams into a relational database schema ensures data integrity by systematically representing entities as relations (tables) and attributes as column fields. Primary keys uniquely identify each tuple within a table, while foreign keys establish valid references across tables. This structured approach ensures consistency and enforces constraints, maintaining the integrity of connected datasets .

Cardinality constraints specify the allowable number of occurrences in a relationship set. They are denoted as m..n, where m is the minimum, and n is the maximum participation of entities in a relation. Examples include one-to-one, many-to-one, one-to-many, and many-to-many correspondences. For example, in a library system, a book (many) can be checked out by one patron (one).

Weak entity sets rely on a relationship with another entity to be fully identified because they lack a sufficient key attribute. In E-R diagrams, these are typically depicted with a double rectangle. These differ from regular entity sets, which have a primary key that uniquely identifies each instance without needing an associated stronger entity .

IS-A hierarchies in E-R diagrams allow for the inheritance of attributes and relationships from a more general entity to more specific entities, facilitating data partitioning. This structure organizes data hierarchically, enabling efficient querying and ensuring shared characteristics are captured at the right level .

Three-entity set relations involve interactions among three distinct entity types. In an E-R diagram, these are modeled using a relationship that links all three entities, usually with lines connecting a central relationship diamond to the participating entities. For instance, a sales transaction involving a Product, Customer, and Supplier would be a three-entity relation, tracking attributes like sales date and price. This modeling captures the multilateral associations among entities .

Relationship tables in relational schema derived from E-R models manage connections between entities, especially for complex relationships involving multiple entity sets. These tables include foreign keys that reference the primary keys of the participating entities. For example, a sales relation involving products, customers, and suppliers would contain foreign keys for each entity type to ensure referential integrity and enable tracking of sales transactions across different entities .

You might also like