ENTITY-RELATIONSHIP MODEL
POINTS TO NOTE :
qwhat is entity-relationship diagram.
qWhy use ER
qSymbols used in ER diagram.
qComponents of ER diagram.
qTypes of attribute.
qTypes of relationship
What is entity-relationship diagram?
An ER diagram/model describes the relationship of
entities that need to be used in a database. It is
mainly a structural design for the database. It is a
framework using specialized symbols to define the
relationship between entities. It is widely used for
database designs.
ER is created based on three main components
1.Entities
2.Attributes
3.Relationship
Example of ER diagramA school needs there students record to be stored
                     digitally. They approach an IT company in that
                     regard, the IT company request an ER diagram from
                     the school authorities.                       Cous
                  Stu    Stu_n   Stu_                 Cous_            _
                  _ID     ame    age                   ID             nam
                                                                       e
                        STUDE               STU               COURS
                          NT                DY                  ES
  Why use ER diagram ?
                                        Entities                      Attributes
1. Helps to conceptualize the database and also
   helps to know which fields needs to be
   embedded for a particular entity.
2. Gives better understanding of the information
   to be stored in database.
3. Reduces complexity and saves time.
Symbols used in ER diagram
                                                                          Use
                                                                        dotted
                                                                         lines
  Entity         Multi valued    Attribute   Relationship Weak entity   derived attribute
Components of ER diagram
                                ATTRIBUT               RELATIONS
   ENTITY
                                   ES                     HIP
 • Strong                   • key                    • One to One
   entity                   • Composite              • One to Many
 • Weak entity              • Multi-valued           • Many to One
                            • derived                • Many to Many
ENTITY            It is the collection of related attribute. It can be a thing,
                  place, person, unit or any item about which the data
                  should be captured and stored in the form of properties.
                  It is represented as a rectangle.
                   STUDEN             STUD
                                                   COURSE
                     T                  Y
ATTRIBUTE         An attribute describes the properties of an entity. It is
                  represented as oval in an ER diagram.
                                                 NAM
                               S_ID
                                                  E
                                        STUDEN         ADDRE
                         AGE
                                           T             SS
       CHARACTERISTICS OF AN
       ATTRIBUTE
KEY ATTRIBUTEThis uniquely identifies an entity from an entity set. The
             text of the attribute is underlined. E.g.. Student_ID can
             uniquely identify a student from a set of students.
What is a Strong Entity?
A strong entity is an entity that is not dependent on any other entity. It has a
primary key, or a table includes a primary key.
What is a Weak Entity?
Unlike a strong entity, a weak entity is not independent as it is reliant on
another strong entity. It has to rely on other entities to ensure its existence.
     S.No. Strong Entity                        Weak Entity
     1    It is independent in nature.          It depends on another strong entity.
     2    It has a primary key.                 It does not have any primary key.
     3    It is depicted by a sole rectangle.   It is depicted by a dual rectangle.
     4    The connection between two            The connection between a weak and a
          strong entities is shown by a sole    strong entity is shown by a dual
          diamond.                              diamond.
                  This is an attribute that is composed of
COMPOSITE ATTRIBUTE
                  other attributes. The composite attribute is
                  represented with an oval, an the other
             Fnam
                  attributes
                    Lnam     isM-
                                further connected to it with
               e  ovals.
                      e      name
                                 NAM
             S_ID
                                  E
                    STUDEN             ADDRE
       AGE
                       T                 SS
MULTI-VALUED ATTRIBUTEThis is an attribute that can possess more
                                       than one value. It makes use of double oval.
                                           NAM
                          S_ID
                                            E
                                  STUDEN          PHON
                    AGE                             E
                                     T
DERIVED ATTRIBUTEThis is an attribute that can be extracted
                 from other attribute of the entity. It is
                 represented with dashed oval.
                                               NAM
                               S_ID
                                                E
                                      STUDEN
                         AGE                         DOB
                                         T
                          RELATIONSHIP
  A relationship is used to show the relation among entities. It makes use
  of diamond shape.
                    TYPES OF RELATIONSHIP
ONE TO ONE:      When a single element of an entity is associated with
                 a single element of another entity. For example. A
                 student has ONLY ONE identification card. And ONE
                 identification card is given to ONE student
          STUDENT      1    HAS     1   ID CARD
ONE TO MANY: When a single element of an entity is associated
                    with more than one element of another entity. For
                    example. A customer can place MANY orders but an
                    order cannot be place by many customers.
          CUSTOME      1   PLA      M   ORDER
             R              CE
MANY TO MANY:When more than one element of an entity is
                 associated with more than one element of another
                 entity. For example, employee can be assigned to
                 many projects and a project can have many employee.
                       ASSI
                  M             M
           EMP         GNE          PROJECT
                        D
CLASS ACTIVITY Draw an ER diagram of a bank database,
               where each bank can have multiple branches,
               and each branch can have multiple accounts