Docsity

Entity-Relationship Model: One-to-Many, Many-To-One, and Many-To-Many Relationships, Study notes of Database Management Systems (DBMS)

Partial preview of the text

Download Entity-Relationship Model: One-to-Many, Many-To-One, and Many-To-Many Relationships and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

Module 03:ERModule 03:ER

The Database The Database

Development Process Development Process

And Management And Management

( ( Database ManagementDatabase Management

DESIGN PART-2 DESIGN PART-2 ))

ER MODEL ER MODEL

KEYWORDSKEYWORDS

DATABASE DATABASE

ENTITY ENTITY

RELATIONSHIP RELATIONSHIP

ATTRIBUTES ATTRIBUTES

RECORDS RECORDS

DATABASE MANAGEMENT SYSTEM DATABASE MANAGEMENT SYSTEM

Cont….Cont….

ENTITIES, ATTRIBUTES ANDENTITIES, ATTRIBUTES AND

ASSOCIATION ASSOCIATION ENTITY ENTITY •A THING OR OBJECT•A THING OR OBJECT •A DISTINGUISHABLE OBJECT•A DISTINGUISHABLE OBJECT OR SUBJECT ABOUT WHICH WEOR SUBJECT ABOUT WHICH WE WANT TO COLLECTWANT TO COLLECT INFORMATIONINFORMATION Cont….Cont….

Attributes:Attributes: An entity is represented by a set of An entity is represented by a set of attributes, that is descriptive propertiesattributes, that is descriptive properties possessed by all members of an entity set.possessed by all members of an entity set. Ex:Ex: customer = (customer-id, customer-customer = (customer-id, customer- name, customer-street, customer-city)name, customer-street, customer-city) loan = (loan-number, amount)loan = (loan-number, amount) Domain Domain – the set of permitted values for– the set of permitted values for each attributeeach attribute

ENTITIES , ATTRIBUTES AND ENTITIES , ATTRIBUTES AND

ASSOCIATION ASSOCIATION

EMPLOYEE ID

EMPLOYEE NAME

EMPLOYEE ID

EMPLOYEE.NAME

EMPLOYEE ID

EMPLOYEE NAME

A) ONE TO ONEONE TO ONE

EMPLOYEE ID EMPLOYEE SALARY SALARY EMPLOYEE ID EMPLOYEE ID SALARY

B) ONE TO MANYONE TO MANY

(MANY TO ONE RLTN BTW EMPLOYEE ID & SALARY)

RELATIONSHIP AMONG ENTITIES

RELATIONSHIP EXIST AMONG DIFF ENTITIES EVEN THOUGH RELATIONSHIP MAY INVOLVE MORE THAN TWO ENTITIES - WE WILL CONCENTRATE ON THE RELATIONSHIP BTW TWO ENTITIES

STUDENTS ENROL COURSE LMNT

ENTITY SETS RELATIONSHIP

One-To-Many RelationshipOne-To-Many Relationship

In the one-to-many relationship a loan is In the one-to-many relationship a loan is associated with at most one customerassociated with at most one customer viavia borrowerborrower , a customer is associated, a customer is associated with several (including 0) loans viawith several (including 0) loans via borrower borrower

Many-To-Many RelationshipMany-To-Many Relationship

A customer is associated with A customer is associated with several (possibly 0) loans viaseveral (possibly 0) loans via borrowerborrower A loan is associated with several A loan is associated with several (possibly 0) customers via(possibly 0) customers via borrowerborrower

REPORTS TO

EMPLOYEE

UNARY RELATIONSHIP INVOLVING S

Entity-Relationship ModelEntity-Relationship Model

Entity Sets Entity Sets

Relationship Sets Relationship Sets

Design Issues Design Issues

Mapping Constraints Mapping Constraints

Keys Keys

E-R Diagram E-R Diagram

Design of an E-R Database Schema Design of an E-R Database Schema

Reduction of an E-R Schema to Tables Reduction of an E-R Schema to Tables

Entity SetsEntity Sets

A A databasedatabase can be modeled as:can be modeled as:  (^) a collection of entities,a collection of entities,  (^) relationship among entities.relationship among entities.

An An entityentity is an object that exists and isis an object that exists and is distinguishable from other objects.distinguishable from other objects. Ex: specific person, company, event, plantEx: specific person, company, event, plant Entities have Entities have attributesattributes Ex: people have Ex: people have namesnames andand addressesaddresses An An entity setentity set is a set of entities of the sameis a set of entities of the same type that share the same properties.type that share the same properties. Ex: set of all persons, companies, treesEx: set of all persons, companies, trees

Attribute typesAttribute types ::

Simple Simple andand compositecomposite attributes.attributes. Single-valued Single-valued andand multi-valuedmulti-valued attributesattributes E.g. multivalued attribute: E.g. multivalued attribute: phone-phone-

Composite AttributesComposite Attributes