0% found this document useful (0 votes)
61 views34 pages

Entity Relationship Model: Bikash Chhetri

1. An Entity Relationship (ER) model describes data as entities, relationships between entities, and attributes. 2. The main components of an ER model are entities, attributes, and relationships. Entities can be people, places, or objects. Attributes describe entities. Relationships show how entities are connected. 3. Relationships have cardinalities like one-to-one, one-to-many, many-to-one, and many-to-many that describe the number of entities that can be related. Attributes also have types like key, composite, multivalued, and derived.

Uploaded by

Bikash Chhetri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views34 pages

Entity Relationship Model: Bikash Chhetri

1. An Entity Relationship (ER) model describes data as entities, relationships between entities, and attributes. 2. The main components of an ER model are entities, attributes, and relationships. Entities can be people, places, or objects. Attributes describe entities. Relationships show how entities are connected. 3. Relationships have cardinalities like one-to-one, one-to-many, many-to-one, and many-to-many that describe the number of entities that can be related. Attributes also have types like key, composite, multivalued, and derived.

Uploaded by

Bikash Chhetri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

UNIT 2 Entity Relationship model

BIKASH CHHETRI
DATA MODEL

• Data models are collection of concepts for describing data, data relationship, data schematics and the
consistency constraints.
TYPES OF DATA MODEL

1. Object based logical model


2. Record based logical model
3. Physical Model
RECORD BASED LOGICAL MODEL

• Relational model
• Network model
• Hierarchical model
OBJECT BASED LOGICAL MODEL

• Entity relationship model(ER Model)


• Object oriented model
• Schematic data model
• Functional data model
2.1 ER MODEL

1. ER Model describes data as entities relationship attributes and represents the logical structure of the
database.
2.  An ER model is a design or blueprint of a database that can later be implemented as a database.
3. The main components of E-R model are: entity set and relationship set.
AS SHOWN IN THE ABOVE DIAGRAM, AN ER
DIAGRAM HAS THREE MAIN COMPONENTS:

1. Entity
2. Attribute
3. Relationship
ATTRIBUTES

1. Attributes are the properties that describe an entity.


2. An attribute is represented as Oval in an ER diagram.
3. Example:- Student entity the attribute are roll no, name , branch etc.
TYPES OF ATTRIBUTES

1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute
KEY ATTRIBUTE

• A key attribute can uniquely identify an entity from an entity set.


• For example, student roll number can uniquely identify a student from a set of students.
• Key attribute is represented by oval same as other attributes however the text of key attribute is
underlined.
COMPOSITE ATTRIBUTE:

• An attribute that is a combination of other attributes is known as composite attribute.


• For example, In student entity, the student address is a composite attribute as an address is composed
of other attributes such as pin code, state, country.
MULTIVALUED ATTRIBUTE:

• An attribute that can hold multiple values is known as multivalued attribute.


• It is represented with double ovals in an ER Diagram.
• For example – A person can have more than one phone numbers so the phone number attribute is
multivalued.

Example of a multivalued attribute


DERIVED ATTRIBUTE:

• A derived attribute is one whose value is dynamic and derived from another attribute.
• It is represented by dashed oval in an ER Diagram.
• For example – Person age is a derived attribute as it changes over time and can be derived from
another attribute (Date of birth).

Derived Attribute in ER diagrams


E-R DIAGRAM WITH MULTIVALUED AND DERIVED
ATTRIBUTES:
NOTATION OF ATTRIBUTES IN ER DIAGRAM
DATA TYPE

1. Integer
2. Character
3. Float
4. Date
5. BLOB
INTEGER

• Integer – is a whole number that can have a positive, negative or zero value. It cannot be a fraction nor
can have decimal places.  It is commonly used in programming especially for increasing values.
CHARACTER

• Character – refers to any number, letter, space or symbol that can be entered in a computer. Each
character occupies one byte of space.
FLOAT

• Floating Point Number – is a number that contains decimals. Numbers that contain fractions are also
considered as floating point numbers.
DATE

• Date field contain data and time.


BLOB

• BLOB stands for binary large Object and this attribute type is used for storing information such as image,
multimedia or bits of code in a filed.
Entity
• An entity can be a person, place, event, or object that is relevant to a given system.
• For example, a school system may include students, teachers, major courses, subjects, fees, and other
items.
• Entities are represented in ER diagrams by a rectangle.

Weak Entity
• A weak entity is an entity that depends on the existence of another entity.

Employee Has Family

Weak Entity Example in ER diagrams


TYPES OF ENTITY KEYS

1. Super key
2. Candidate key
3. Primary key
SUPER KEY

1. A super key is a group of single or multiple keys which identifies rows in a table.
2. A Super key may have additional attributes that are not needed for unique identification.

Example:-

EmpSSN EmpNum Empname


9812345098 AB05 Shown
9876512345 AB06 Roslyn
199937890 AB07 James

In the above-given example, EmpSSN and EmpNum name are superkeys.


CANDIDATE KEY

• CANDIDATE KEY is a set of attributes that uniquely identify tuples in a table.


• Candidate Key is a super key with no repeated attributes.
• The Primary key should be selected from the candidate keys.
• Every table must have at least a single candidate key.
• A table can have multiple candidate keys but only a single primary key.
Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to uniquely identify
the student record in the table.

StudID Roll No First Name LastName Email


1 11 Tom Price abc@gmail.co
m
2 12 Nick Wright xyz@gmail.co
m
3 13 Dana Natan mno@yahoo.c
om
PRIMARY KEY

• PRIMARY KEY is a column or group of columns in a table that uniquely identify every row in that table.
The Primary Key can't be a duplicate meaning the same value can't appear more than once in the table.
A table cannot have more than one primary key.
Example:
In the following example, <code>StudID</code> is a Primary Key.

StudID Roll No First Name LastName Email


1 11 Tom Price abc@gmail.co
m
2 12 Nick Wright xyz@gmail.co
m
3 13 Dana Natan mno@yahoo.c
om
Relationship
1. Relationships are represented by diamond-shaped
box. Name of the relationship is written inside the
diamond-box.
2. All the entities (rectangles) participating in a
relationship, are connected to it by a line.
MAPPING CARDINALITIES:-
The identifying property of a relationship is known as its cardinalities.

• One-to-one − When only one instance of an entity is associated with the relationship, it is
marked as '1:1
One-to-many − When more than one instance of an
entity is associated with a relationship, it is marked as
'1:N'.

Many-to-one − When more than one instance of entity is


associated with the relationship, it is marked as 'N:1'.

Many-to-many − The following image reflects that more


than one instance of an entity on the left and more than
one instance of an entity on the right can be associated
with the relationship.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy