You are on page 1of 7

Experiment-1

Introduction to ER Diagram

Introduction: An Entity Relationship (ER) Diagram is a type of flowchart that


illustrates how “entities” such as people, objects or concepts relate to each other
within a system. ER Diagrams are most often used to design or debug relational
databases in the fields of software engineering, business information systems,
education and research. Also known as ERDs or ER Models, they use a defined set
of symbols such as rectangles, diamonds, ovals and connecting lines to depict the
interconnectedness of entities, relationships and their attributes. They mirror
grammatical structure, with entities as nouns and relationships as verbs.

The components and features of an ER diagram

ER Diagrams are composed of entities, relationships and attributes. They also


depict cardinality, which defines relationships in terms of numbers. Here’s a
glossary:

Entity: A definable thing such as a person, object, concept or event that can
have data stored about it. Think of entities as nouns. Examples: a customer,
student, car or product. Typically shown as a rectangle.

 Entity categories: Entities are categorized as strong, weak or associative.


A strong entity can be defined solely by its own attributes, while a weak
entity cannot. An associative entity associates entities (or elements) within
an entity set.
 Entity keys: Refers to an attribute that uniquely defines an entity in an
entity set. Entity keys can be super, candidate or primary.
 Super key: A set of attributes (one or more) that together define an
entity in an entity set.
 Candidate key: A minimal super key, meaning it has the least
possible number of attributes to still be a super key. An entity set
may have more than one candidate key.
 Primary key: A candidate key chosen by the database designer
to uniquely identify the entity set.
 Foreign key: Identifies the relationship between entities.

05313203120 | IT-1
Kushagra Kaushik
Relationship: How entities act upon each other or are associated with each
other. Think of relationships as verbs. For example, the named student might
register for a course. The two entities would be the student and the course, and
the relationship depicted is the act of enrolling, connecting the two entities in
that way. Relationships are typically shown as diamonds or labels directly on
the connecting lines.

 One-to-one: When only one instance of an entity is associated with the


relationship, it is marked as '1:1'. The following image reflects that only
one instance of each entity should be associated with the relationship. It
depicts one-to-one relationship.

 One-to-many: When more than one instance of an entity is associated with


a relationship, it is marked as '1:N'. The following image reflects that only
one instance of entity on the left and more than one instance of an entity on
the right can be associated with the relationship. It depicts one-to-many
relationship.

 Many-to-one: When more than one instance of entity is associated with


the relationship, it is marked as 'N:1'. The following image reflects that
more than one instance of an entity on the left and only one instance of
an entity on the right can be associated with the relationship. It depicts
many-to-one relationship.

05313203120 | IT-1
Kushagra Kaushik
 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. It depicts many-to-many
relationship.

Attribute: It is a property or characteristic of an entity. It is often shown as an oval


or circle.

Attribute categories: Attributes are categorized as simple, composite, derived, as


well as single- value or multi-value. Simple: Means the attribute value is atomic
and can’t be further divided, such as a phone number. Composite: Sub-attributes
spring from an attribute. Derived: Attributed is calculated or otherwise derived
from another attribute, such as age from a birthdate.

 Key Attribute –
The attribute which uniquely identifies each entity in the entity set is
called key attribute. For example, Roll_No will be unique for each student. In
ER diagram, key attribute is represented by an oval with underlying lines.

 Composite Attribute –
An attribute composed of many other attribute is called as composite
attribute. For example, Address attribute of student Entity type consists

05313203120 | IT-1
Kushagra Kaushik
of Street, City, State, and Country. In ER diagram, composite attribute is
represented by an oval comprising of ovals.

 Multivalued Attribute –
An attribute consisting more than one value for a given entity. For
example, Phone_No (can be more than one for a given student). In ER
diagram, multivalued attribute is represented by double oval.

 Derived Attribute –
An attribute which can be derived from other attributes of the entity type
is known as derived attribute. e.g.; Age (can be derived from DOB). In ER
diagram, derived attribute is represented by dashed oval.

05313203120 | IT-1
Kushagra Kaushik
Experiment-2(i)
ER Diagram for Book Management
System

Objective: To design an ER diagram for a Book Management System.

Software Used: Star UML Software

Entities used in the ER Diagram:

 Book: It is the Entity that contains all the relevant information


regarding a particular book.
 Member: It is the Entity that contains information of a Library Member.
 Publisher: It is the Entity that contains information regarding the
publisher of a particular book.
 Staff: It is an Entity which tells us about the staff members.
 Supplier: It is an Entity which tells us about the Book Suppliers.

Attributes of various Entities used in the ER Diagram

Book –

 Book_ID: It is the Primary key. It Makes Every Book Unique and


makes it easy to differentiate between a specific book from other
books.
 Book_Name: It stores the Title of the Book.
 Type: It stores the subject, the book is relevant to.
 Author: It stores the Name of the Books’ Author.
 Publisher: It also comes under the category of multivalued attribute
and it tells us about the book publisher.
 Availability: It stores a Boolean Value by checking whether the book
is currently available to the member or not.

Member –

 Member_ID: It is the Primary key. It Makes Every Member Unique and


makes it easy to differentiate between various members.
 Member_Name: It Stores the Name of a particular member.
 Member_Contact: It Stores the Contact Details of a particular member.
 Member_type: A multivalued attribute which tells us about the member
05313203120 | IT-1
Kushagra Kaushik
type.
 Member_date : Every member has a pass to get an access to the library. It
tells us about the membership Eligibility.
 Fine: An integer datatype and a single value attribute.

Publisher –

 Publisher_ID: It is the Primary key. It Makes Every Publisher Unique and


makes it easy to differentiate between various Publishers.
 Publisher_Name: It Stores the Name of a particular Publisher.
 Publisher_Contact: It Stores the Contact details of a particular Publisher.
 Publisher_Address: It Stores the Address Details of a particular Publisher.
 Published_book: A composite attribute of the entity book.

Staff -

 Gender: An atomic attribute.


 Email_id: A single valued attribute.
 Qualifications: A multivalued attribute.
 DOB: It also acts like a single attribute.
 Phone_no.: A singled valued attribute for the entity staff.
 Staff_id: It uniquely identifies therefore it behaves as a primary key.

Supplier -

 Supplier_ID: A primary key for supplier entity.


 Name: A composite attribute.
 Phone_no: A singled value attribute.
 Email_id: Only 1 value can be is for 1 entity therefore a single attribute.
 Address: A composite type of attribute as it can be sub divided.
 Gender: An atomic attribute.
 Supply_area: A multivalued attribute.

Relationships used in the ER Diagram

Borrowed by: It’s a Many to Many relationship between a Member and a book
when a Member issues a book from the library.

Attributes:

 Due date: Date by which a book borrowed must be returned. A simple


attribute as only one due date is applicable.
 Issue_Date: Date when book was issued to the member.
05313203120 | IT-1
Kushagra Kaushik
 Return_Date: Date till can be a book must be return.

Published by: It’s a Many to Many relationship between a Member and a Publisher
when a publisher publishes a book for the member.

Attributes:

 Published_Date: Date on which the book got published by. A simple


attribute.
 Published_Edition: Editon of the respective books. A multivalued attribute.

Supplies: It is a many to many relationship between the boo supplier and


the book & the Member and the supplier.

Attributes:

 Supplied_Date: Date on which the book was supplied.


 Supplied_Day: Day on which it was supplied.
 Supplied_Time: Time at which various books were supplied.

Manages: It is a many to many relationship between the staff and the books.

ER Diagram:

05313203120 | IT-1
Kushagra Kaushik

You might also like