Docsity

Conceptual Modeling of Data: Entity-Relationship Model and Database Design, Schemes and Mind Maps of Design

Partial preview of the text

Download Conceptual Modeling of Data: Entity-Relationship Model and Database Design and more Schemes and Mind Maps Design in PDF only on Docsity!

Conceptual Modeling of Data

Prof. S. Mehrotra

Information and Computer Science

Department

University of California at Irvine

Outline

w Database design process

w Entity/Relationship Model

n Entity sets n Relationship sets n Constraints on entity sets n Constraints on relationship sets n Weak entity sets n Superclass/subclass relationships n Aggregation

w Good Design Principles

w Examples

high level specs

conceptual schema logical schema (in DBMS model)

miniworld

conceptual design

logical design

physical design

functional analysis

application design

transaction implementation

functional requirements Data requirements

application programs Physical schema

Requirement Analysis

Functional Design Database Design

Database Design Process

Database Design Tools

w Help partially automate the design cycle.

w Graphical interface to specify conceptual schemas.

w Partially automated techniques to map to logical (DBMS

dependent) model.

w Features of a good design tool:

n Iterative: errors /shortcomings of original design found later can be corrected without full restart. n Interactive: any design choices made by system during design should be based on interaction with designer. n Feedback: a designer’s change made at logical and/or physical levels should be automatically translated to changes at higher levels.

w Example Design tools: ERwin by LogicWorks.

w Database design tools integrated into CASE tools and

supported by most modern DBMSs.

Overview of Entity/Relationship

(E/R) Model

w Entities

w Relationships

w Roles of entities in a relationship

w Constraints on entities:

n domain constraints n key constraints

w Constraints on relationships

n Cardinality Constraints (mapping constraints in SKS) n Participation Constraints (existence dependencies in SKS)

w Weak Entity Sets

w Multiway relationships

w Subclass/superclass Relationships

w Aggregation

Entiities and Entity Sets

w Entities

n nouns, ‘things’ in the world. n E.g., students, courses, employees, departments, flights, patients, ...

w Attributes

n properties of entities. n E.g., course name, deptname, departure time, age, room#, ...

w Entity set -- a set of entities that have the same

attributes.

n In OO terminology, an entity set is similar to a class, and an entity similar to an instance

sam 62900 main austin

pat 62901 north urbana

259 10000

245 2400 364 200000

305 20000

customer account

Relationships

w Relationship:

n association between multiple entities

w Relationship Set :

n set if relationships over the same entity sets

w Binary, Ternary, 4-nary, … relationship sets

Cust-AccountRelationship set

Visualizing ER Relationships as a

Table

Relationship Set Corresponding to the Relationship Cust-Account

Row in the table represents the pair of entities participating in the relationship

Customer Account John 1001 Megan 1001 Megan 2001

employee works for

Roles in a Relationship

w The function that an entity plays in a

relationship is called its role

w Roles are normally not explicitly specified

unless the meaning of the relationship needs

clarification

w Roles needed when entity set is related to

itself via a relationship.

manager

worker

Constraints on Entity Sets

w Key Constraint:

n With each entity set a notion of a key can be associated. n A key is a set of attributes that uniquely identify an entity in entity set. n Examples: w designer may specify that {ssno} is a key for a entity set customer entity with attributes {ssno, accountno, balance, name, address} w designer may specify that {accountno} is also a key , that is, no joint accounts are permitted. n Denoted in ER diagram by underlining the attributes that form a key n multiple keys may exist in which case one chosen as primary key and underlined. Other keys called secondary keys either not indicated or listed in a side comment attached to the diagram.

Cardinality Constraints on

Relationship Sets

w Consider binary relationship set R between entity sets A

and B

w One to one: an entity in A is associated with at most

one entity in B, and an entity in B is associated with atmost one entity in A. n an employee has only one spouse in a married-to relationship_._

w Many to One : An entity in A is associated with many

entity in B, an entity in B is associated with at most one entity in A. n an employee works in a single department but a department consists of many employees.

Cardinality Constraints on

Relationship Sets (cont.)

w Many to Many: An entity in A is associated with many

entities in B, and an entity in B is associated with many entities in A. n A customer may have many bank accounts. Accounts may be joint between multiple customers.

Many to Many Relationship

w Multiple customers can share an account

w Many accounts may have one owner

customer custacct account

opening date

Customer Account Start Date John 1001 Jan 20th^1999 Megan 1001 March 16th^1999 Megan 2001 Feb 18th^1994

Customer Account Start Date John 1001 Jan 20th^1999 Megan 1001 March 16th^1999

legal legal

Many to One Relationship

w Multiple customers can share an account but one

customer can have only one account.

Customer Account Start Date John 1001 Jan 20th^1999 Megan 1001 March 16th^1999 Megan 2001 Feb 18th^1994

Illegal

Customer Account Start Date John 1001 Jan 20th^1999 Megan 1001 March 16th^1999

legal

customer (^) custacct account

opening date