Sei sulla pagina 1di 60

Unit 3 - Data Modeling

Pratian Technologies (India) Pvt. Ltd.


www.pratian.com

Enterprise Model
In Enterprise data modelling
Review current systems Analyze the nature of business areas to be supported Describe the data needed at a very high level of abstraction Plan one or more database development projects

Copyright 2012 Pratian Technologies www.pratian.com

Systems Development Life Cycle


Project Identification and Selection Project Project Initiation Initiation and and Planning Planning

Purpose state business situation and solution Deliverable request for analysis

Analysis

Logical Design Physical Design

Database activity conceptual data modeling

Implementation Maintenance

Copyright 2012 Pratian Technologies www.pratian.com

Systems Development Life Cycle


Project Identification and Selection Project Initiation and Planning

Purpose thorough analysis Deliverable functional system specifications

Analysis Analysis

Logical Design Physical Design

Database activity conceptual data modeling

Implementation Maintenance

Copyright 2012 Pratian Technologies www.pratian.com

Systems Development Life Cycle


Project Identification and Selection Project Initiation and Planning Analysis

Purpose information requirements structure Deliverable detailed design specifications

Logical Logical Design Design Physical Design

Database activity logical database design

Implementation Maintenance

Copyright 2012 Pratian Technologies www.pratian.com

Systems Development Life Cycle


Project Identification and Selection Project Initiation and Planning Analysis

Purpose develop technology specs Deliverable program/data structures, technology purchases, organization redesigns

Logical Design Physical Physical Design Design

Database activity physical database design

Implementation Maintenance

Copyright 2012 Pratian Technologies www.pratian.com

Systems Development Life Cycle


Project Identification and Selection Project Initiation and Planning Analysis

Purpose programming, testing, training, installation, documenting Deliverable operational programs, documentation, training materials

Logical Design Physical Design

Database activity database implementation

Implementation Implementation Maintenance

Copyright 2012 Pratian Technologies www.pratian.com

Systems Development Life Cycle


Project Identification and Selection Project Initiation and Planning Analysis

Purpose monitor, repair, enhance Deliverable periodic audits

Logical Design Physical Design

Database activity database maintenance

Implementation Maintenance Maintenance

Copyright 2012 Pratian Technologies www.pratian.com

In short Database Design

Mini-World View Requirements Collection and Analysis Conceptual Design Data Model Mapping Physical Design

Copyright 2012 Pratian Technologies www.pratian.com

Business rule
A statement that defines or constrains some aspect of the business. It is intended to assert business structure or to control or influence the behavior of the business. Ex: A preferred customer qualifies for a 10% discount, unless he has an overdue account balance.

Copyright 2012 Pratian Technologies www.pratian.com

Entity Relationship Modelling


Entity Relationship (ER) modelling is a design tool is a graphical representation of the database system provides a high-level conceptual data model supports the users perception of the data is DBMS and hardware independent has many variants is composed of entities, attributes, and relationships

Copyright 2012 Pratian Technologies www.pratian.com

The Entity Relationship Model


Customer_name Customer_addr Customer_id accountnumber balance

Customer

Depositor

Account

Rectangles represent entity sets Ellipses represent attributes Diamonds represent sets of relationships among a member from each of several entity sets Lines links attributes to entity sets and entity sets to relationships
Copyright 2012 Pratian Technologies www.pratian.com

Components of an E R Model
Entities Attributes Entity Identifiers Instances of Entities Attribute Domains

Copyright 2012 Pratian Technologies www.pratian.com

Entities
Definition

A person, place, object, event, or concept in the user environment about which the organization wishes to maintain data

Copyright 2012 Pratian Technologies www.pratian.com

Entity Type Vs Entity Instances


An Entity Type is a collection of entities that share common properties or characteristics. Ex of Entity Type
Person EMPLOYEE, STUDENT, PATIENT Place STORE, WAREHOUSE, HOSPITAL Object MACHINE, BUILDING, VEHICLE Event SALE, REGISTRATION, RENEWAL Concept ACCOUNT, COURSE, WORK CENTER

An Entity Instance is a single occurrence of an Entity Type

Copyright 2012 Pratian Technologies www.pratian.com

Types of Attributes
Simple Attribute / Atomic Attribute
Ex: Age, Salary, Sex

Composite Attribute
Ex : Address, Full Name

Copyright 2012 Pratian Technologies www.pratian.com

Types of Attributes contd


Single Valued Attribute
Ex: Gender

Copyright 2012 Pratian Technologies www.pratian.com

Types of Attributes contd


Multi Valued Attribute
Ex: Hobby, Educational Qualification, Skill empNum 123 333 679 empPhone 233-9876 233-1231 233-1231 BA, BSc, PhD BSc, MSc empDegree

Copyright 2012 Pratian Technologies www.pratian.com

Types of Attributes contd


Derived Attribute
Ex: Age

Copyright 2012 Pratian Technologies www.pratian.com

E R Diagram Conventions
First name Last name

name class date _of_birth

hobby

STUDENT

age

address street state

roll_number

city

pin

Entities Rectangular Box Attribute Ellipse Entity Name Uppercase Attribute Name Lowercase Primary Key - Underlined
Copyright 2012 Pratian Technologies www.pratian.com

Single Line Simple /single valued Dotted Line Derived Double Line Multivalued Components of composite attribute are shown as ellipses emanating from the composite attributes

Key Attributes
Key is an attribute, or a minimal set of attributes, that uniquely identify entities in an entity set.

Copyright 2012 Pratian Technologies www.pratian.com

Composite Identifier
An identifier that consists of a composite attribute Ex: Entity FLIGHT with composite identifier flightID FlightID has component attributes flightno and date

flightNo FLIGHT flightID date

Copyright 2012 Pratian Technologies www.pratian.com

Non-key Attributes
Non-key attributes are attributes that are not part of a key. Generally, most attributes are simply descriptive, and fall into this category. Consider attributes for first name, last name, birth date; usually these attributes are non-key attributes.

Copyright 2012 Pratian Technologies www.pratian.com

Relationships
A Relationship is an association between entities Relationship instance is an association between entity instances where each relationship instance includes exactly one entity from each participating entity type

PUBLISHER

publishes

BOOK

Copyright 2012 Pratian Technologies www.pratian.com

Degree of a relationship
Unary A unary relationship exists when an association is maintained within a single entity

EMPLOYEE

manages

Copyright 2012 Pratian Technologies www.pratian.com

Binary Relationship
A binary relationship exists when two entities are associated

PUBLISHER

publishes

BOOK

Copyright 2012 Pratian Technologies www.pratian.com

Ternary Relationship
A ternary relationship exists when there are 3 entities associated TEACHER

SUBJECT

teaches

STUDENT

Copyright 2012 Pratian Technologies www.pratian.com

Quaternary relationship
A quaternary relationship exists when there are four entities associated. TEACHER

STUDENT

studies

COURSE_ MATERIAL

SUBJECT
Copyright 2012 Pratian Technologies www.pratian.com

CONNECTIVITY
One to One
Ex: Manager manages 1 Department

One to Many
Ex: Department has many Employees

Many to Many
Ex: (No. of )Employee joins many Courses

Copyright 2012 Pratian Technologies www.pratian.com

CARDINALITY
Mapping Cardinality expresses the specific number of entity occurrences associated with one occurrence of the related entity DEPARTMENT 1 has N EMPLOYEE

(0,100) N

(1,1) N

EMPLOYEE

joins

COURSE

(0,2)
Copyright 2012 Pratian Technologies www.pratian.com

(0,10)

A cardinality constraint
Specifies the number of instance of one entity that can (or must) be associated with each instance of another entity

Minimum cardinality
The minimum number of instances of one entity that may be associated with each instance of another entity.

Maximum cardinality
The maximum number of instances of one entity that may be associated with each instance of another entity.

Copyright 2012 Pratian Technologies www.pratian.com

Participation Constraints
There are two ways an entity can participate in a relationship
Totally / Mandatory Partially / Optional

N EMPLOYEE (0,2) Mandatory joins

COURSE

(1,10) Optional

Copyright 2012 Pratian Technologies www.pratian.com

Employee

Assigned to

Project

Copyright 2012 Pratian Technologies www.pratian.com

Copyright 2012 Pratian Technologies www.pratian.com

Associative Entities
Its an Entity it has attributes AND its a Relationship it links entities together When should a relationship with attributes instead be an Associative Entity?
All relationships for the participating entity types are many relationships The associative entity could have meaning independent of the other entities The associative entity preferably has a unique identifier, and should also have other attributes The associative entity may participate in other relationships other than the entities of the associated relationship Ternary relationships should be converted to associative entities

Copyright 2012 Pratian Technologies www.pratian.com

Associative Entities

Associative entity involves a rectangle with a diamond inside. Note that the many-to-many cardinality symbols face toward the associative entity and not toward the other entities

Copyright 2012 Pratian Technologies www.pratian.com

Another situation for Associative entity


Many to Many relationships must be broken down to one to many relationships

AUTHOR

Submits work

PUBLISHER

Copyright 2012 Pratian Technologies www.pratian.com

AUTHORS TABLE AUTHORID A1 NAME SHOBHA DE CITY MUMBAI COUNTRY INDIA

PUBLISHER TABLE PUB_ID P1 NAME MCGRAW HILL CITY NEW YORK COUNTRY U.S.A

WORK TABLE AUTHORID A1 PUB_ID P1 TITLE SISTERS

Copyright 2012 Pratian Technologies www.pratian.com

pub_id authorid title

AUTHOR

N WORK

1 PUBLISHER

authorid

name pub_id city country city country name

Copyright 2012 Pratian Technologies www.pratian.com

A unary relationship with an attribute. This has a manyto-many relationship

Representing a bill-of -materials structure


Copyright 2012 Pratian Technologies www.pratian.com

An associative entity bill of materials structure

Copyright 2012 Pratian Technologies www.pratian.com

A ternary relationship with attributes

Copyright 2012 Pratian Technologies www.pratian.com

Ternary relationship as an associative entity

Copyright 2012 Pratian Technologies www.pratian.com

To summarise : Associative Entity


An entity type that associates the instances of one or more entity types Contains attributes that are peculiar to the relationship between those entity instances.

Copyright 2012 Pratian Technologies www.pratian.com

SUMMARY

Relationship symbols

Entity symbols

Attribute symbols

A special entity that is also a relationship

Relationship cardinalities specify how many of each entity type is allowed


Copyright 2012 Pratian Technologies www.pratian.com

Relationship degrees specify number of entity types involved

A Comparison of ER Modeling Symbols

Copyright 2012 Pratian Technologies www.pratian.com

ER Diagram: Two Most Commonly Used Notations

Copyright 2012 Pratian Technologies www.pratian.com

A quick check of our understanding.

Copyright 2012 Pratian Technologies www.pratian.com

Simple key attribute

The key is underlined

Copyright 2012 Pratian Technologies www.pratian.com

Composite key attribute

The key is composed of two subparts

Copyright 2012 Pratian Technologies www.pratian.com

Entity with a multivalued attribute (Skill) and derived attribute (Years_Employed) Whats wrong with this?

Derived
from date employed and current date

Multivalued:
an employee can have more than one skill

Copyright 2012 Pratian Technologies www.pratian.com

An attribute that is both multivalued and composite

This is an example of time-stamping

Copyright 2012 Pratian Technologies www.pratian.com

Copyright 2012 Pratian Technologies www.pratian.com

Copyright 2012 Pratian Technologies www.pratian.com

Note: a relationship can have attributes of its own


Copyright 2012 Pratian Technologies www.pratian.com

Mandatory cardinalities

Copyright 2012 Pratian Technologies www.pratian.com

Optional cardinalities with unary degree, one-to-one relationship

Copyright 2012 Pratian Technologies www.pratian.com

Entities can be related to one another in more than one way

Copyright 2012 Pratian Technologies www.pratian.com

Here,max cardinality constraint is 4

Copyright 2012 Pratian Technologies www.pratian.com

Question time
Please try to limit the questions to the topics discussed during the session. Thank you.

Copyright 2012 Pratian Technologies www.pratian.com

Potrebbero piacerti anche