13- er diagram (1) php

16

Upload: raja-kumar

Post on 15-Jan-2015

148 views

Category:

Education


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 13- Er diagram (1) php
Page 2: 13- Er diagram (1) php

Entity Relationship(ER) Entity Relationship(ER) DiagramDiagram

Page 3: 13- Er diagram (1) php

An entity-relationship diagram is An entity-relationship diagram is a a data modelingdata modeling technique that  technique that creates a graphical representation of creates a graphical representation of the entities, and the relationships the entities, and the relationships between entities, within an between entities, within an information system.information system.

ER-DiagramER-Diagram

Page 4: 13- Er diagram (1) php

Sample ER-DiagramSample ER-Diagram

Page 5: 13- Er diagram (1) php

An E-R Diagram shows a database’s An E-R Diagram shows a database’s entities and the relationships among entities and the relationships among the entities in a symbolic, visual way.the entities in a symbolic, visual way. Documents a project or application and Documents a project or application and

serves as its foundationserves as its foundation Clarify the system/application’s features Clarify the system/application’s features Provide a basis for evaluating Provide a basis for evaluating

development optionsdevelopment options

Purpose of ERDs

Page 6: 13- Er diagram (1) php

Entity:Entity: A class of persons, places, objects, events, or A class of persons, places, objects, events, or concepts about which we need to capture and store concepts about which we need to capture and store data.data. Named by a singular noun.Named by a singular noun.PersonsPersons: agency, contractor, customer, : agency, contractor, customer, department, division, employee, department, division, employee, instructor, student, supplier. instructor, student, supplier.

PlacesPlaces: sales region, building, room, : sales region, building, room, branch office, campus.branch office, campus.

ObjectsObjects: book, machine, part, product, raw material, software license, : book, machine, part, product, raw material, software license, software package, tool, vehicle model, vehicle. software package, tool, vehicle model, vehicle.

EventsEvents: application, award, cancellation, class, flight, invoice, order, : application, award, cancellation, class, flight, invoice, order, registration, renewal, requisition, reservation, sale, trip. registration, renewal, requisition, reservation, sale, trip.

ConceptsConcepts: account, block of time, bond, course, fund, qualification, stock. : account, block of time, bond, course, fund, qualification, stock.

Components of ERD

Page 7: 13- Er diagram (1) php

Relationship: Relationship: natural business association that exists between one or natural business association that exists between one or more entities. more entities. The relationship may represent an event that links the The relationship may represent an event that links the entities or merely a logical affinity that exists between the entities or merely a logical affinity that exists between the entities. entities.

Components of ERD Contd:

Page 8: 13- Er diagram (1) php

CardinalityCardinalityThe minimum and maximum number of occurrences of one The minimum and maximum number of occurrences of one entity that may be related to a single occurrence of the other entity that may be related to a single occurrence of the other entity.entity.Because all relationships are bidirectional, cardinality must Because all relationships are bidirectional, cardinality must be defined in both directions for every relationship. be defined in both directions for every relationship.

Components of ERD

Bidirectional

Page 9: 13- Er diagram (1) php

AttributeAttribute::A descriptive property or A descriptive property or characteristic of an entity. characteristic of an entity. Synonyms include Synonyms include elementelement, , propertyproperty, and , and fieldfield. . Just as a physical student Just as a physical student can have attributes, such as can have attributes, such as hair color, height, etc., data hair color, height, etc., data entity has data attributesentity has data attributes

Compound attribute:Compound attribute: An attribute that consists of An attribute that consists of other attributes. Synonyms in other attributes. Synonyms in different data modeling different data modeling languages are numerous: languages are numerous: concatenated attribute, concatenated attribute, composite attribute, and data composite attribute, and data structure.structure.

Components of ERD

Page 10: 13- Er diagram (1) php

Cardinality Notations:Cardinality Notations:

Components of ERD

Page 11: 13- Er diagram (1) php

Degree:The number of entities that participate in the relationship. The number of entities that participate in the relationship.

Components of ERD

Page 12: 13- Er diagram (1) php

Associative entityAssociative entity::An entity that An entity that inherits primary key inherits primary key from more than one from more than one other entity (called other entity (called parents). parents).

Components of ERD

Page 13: 13- Er diagram (1) php

Foreign key:Foreign key: A primary key of an entity that is used in another entity to A primary key of an entity that is used in another entity to identify instances of a relationship.identify instances of a relationship.A foreign key is a primary key of one entity that is A foreign key is a primary key of one entity that is contributed to (duplicated in) another entity to identify contributed to (duplicated in) another entity to identify instances of a relationship.instances of a relationship.A foreign key always matches the primary key in the another A foreign key always matches the primary key in the another entityentityA foreign key may or may not be unique (generally not)A foreign key may or may not be unique (generally not)The entity with the foreign key is called the child.The entity with the foreign key is called the child.The entity with the matching primary key is called the parent.The entity with the matching primary key is called the parent.

Components of ERD

Page 14: 13- Er diagram (1) php

Parent entity A data entity that contributes one or more attributes to another entity, called the child. In a one-to-many relationship the parent is the entity on the "one" side.

Child entity A data entity that derives one or more attributes from another entity, called the parent. In a one-to-many relationship the child is the entity on the "many" side.

Components of ERD

Page 15: 13- Er diagram (1) php

The steps involved in creating an ERD are:Identify the entities.Determine all significant interactions.Analyze the nature of the interactions.Draw the ERD.

ERD Steps

Page 16: 13- Er diagram (1) php

A good data model is simple.A good data model is simple. Data attributes that describe any given entity Data attributes that describe any given entity

should describe only that entity.should describe only that entity. Each attribute of an entity instance can have Each attribute of an entity instance can have

only one value.only one value.

A good data model is essentially non-redundant.A good data model is essentially non-redundant. Each data attribute, other than foreign keys, Each data attribute, other than foreign keys,

describes at most one entity.describes at most one entity. Look for the same attribute recorded more Look for the same attribute recorded more

than once under different names.than once under different names.

A good data model should be flexible and A good data model should be flexible and adaptable to future needs.adaptable to future needs.

What is a Good Data Model?