0% found this document useful (0 votes)
39 views

Practical 1

This document provides an overview of entity-relationship (ER) modeling and diagrams. It defines the key components of an ER diagram, including entities, attributes, relationships, and cardinality. It also presents sample ER diagrams for a student database, company database, bank database, and college database. The document concludes with answers to questions about ER diagrams, including their purpose, symbols used, importance of composite keys, applying cardinality to relationships, and defining normalization.

Uploaded by

Bhushan Chanore
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Practical 1

This document provides an overview of entity-relationship (ER) modeling and diagrams. It defines the key components of an ER diagram, including entities, attributes, relationships, and cardinality. It also presents sample ER diagrams for a student database, company database, bank database, and college database. The document concludes with answers to questions about ER diagrams, including their purpose, symbols used, importance of composite keys, applying cardinality to relationships, and defining normalization.

Uploaded by

Bhushan Chanore
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Government College of Engineering, Jalgaon

(An Autonomous Institute of Government of Maharashtra)


Name : Bhushan Raju Chanore Semester : V PRN : 2041016
Class : T. Y. B.Tech Computer Academic Year : 2022-23 Subject : CO307U
Course Teacher : Mr. Vinit Kakde
Date of Performance : Date of Completion :
Practical no. 1
Aim : Map the ER/EER diagrams to a relational schema. Be sure to underline all primary keys, include
all necessary foreign keys and indicate referential integrity constraints. Create a database of the same
schema using Data Definition Language(DDL). Use all DDL statements(Create, Alter, Drop) with all
possible options and constraints(Primary key, Foreign Key, unique, Not Null, Default, Check etc. ).

ER model
o ER model stands for an Entity-Relationship model. It is a high-level data model. This model is
used to define the data elements and relationship for a specified system.
o It develops a conceptual design for the database. It also develops a very simple and easy to
design view of data.
o In ER modeling, the database structure is portrayed as a diagram called an entity-relationship
diagram.

Component of ER Diagram
1. Entity:
o An entity may be any object, class, person or place. In the ER diagram, an entity can be
represented as rectangles.
o Consider an organization as an example- manager, product, employee, department etc. can be
taken as an entity.

a. Weak Entity
o An entity that depends on another entity called a weak entity. The weak entity doesn't contain
any key attribute of its own. The weak entity is represented by a double rectangle.
o

2. Attribute
o The attribute is used to describe the property of an entity. Eclipse is used to represent an
attribute.
o For example, id, age, contact number, name, etc. can be attributes of a student.

a. Key Attribute
o The key attribute is used to represent the main characteristics of an entity. It represents a
primary key. The key attribute is represented by an ellipse with the text underlined.
b. Composite Attribute
o An attribute that composed of many other attributes is known as a composite attribute. The
composite attribute is represented by an ellipse, and those ellipses are connected with an
ellipse.
o

c. Multivalued Attribute
o An attribute can have more than one value. These attributes are known as a multivalued
attribute. The double oval is used to represent multivalued attribute.
o For example, a student can have more than one phone number.

d. Derived Attribute
o An attribute that can be derived from other attribute is known as a derived attribute. It can be
represented by a dashed ellipse.
o For example, A person's age changes over time and can be derived from another attribute like
Date of birth.

3. Relationship
o A relationship is used to describe the relation between entities. Diamond or rhombus is used to
represent the relationship.

Types of relationship are as follows:


a. One-to-One Relationship
o When only one instance of an entity is associated with the relationship, then it is known as one
to one relationship.
o For example, A female can marry to one male, and a male can marry to one female.

b. One-to-many relationship
o When only one instance of the entity on the left, and more than one instance of an entity on the
right associates with the relationship then this is known as a one-to-many relationship.
o For example, Scientist can invent many inventions, but the invention is done by the only specific
scientist.
c. Many-to-one relationship
o When more than one instance of the entity on the left, and only one instance of an entity on the
right associates with the relationship then it is known as a many-to-one relationship.
o For example, Student enrolls for only one course, but a course can have many students.

d. Many-to-many relationship
o When more than one instance of the entity on the left, and more than one instance of an entity
on the right associates with the relationship then it is known as a many-to-many relationship.
o For example, Employee can assign by many projects and project can have many employees.

Symbols used in ER diagram :


Schemas :
1. College Database :
Student ( PRN, Name, Address, Phone, Gender)
Semester (SSID, Semester, Section)
Class ( PRN, SSID)
Subject ( SubjectCode, Title, Semester, Credits)
MARKS ( PRN, SubjectCode, Test1, Test2, Final)

2. COMPANY DATABASE:
EMPLOYEE (SSN, Name, Address, Sex, Salary, SuperSSN, DNo)
DEPARTMENT (DNo, DName, MgrSSN, MgrStartDate)
DLOCATION (DNo,DLoc)
PROJECT (PNo, PName, PLocation, DNo)
WORKS_ON (SSN, PNo, Hours)

3. Bank Database:
Bank (IFSC code, Name, telephone , Address)
Staff (ID, Name, Address, Phone, Salary, Age)
User (Account number, Name, Address, Phone, Balance, DOB, aadhar number, Account type,
Opening date)

4. College Database:
College (RegNo, Address, Name)
Office_Staff (ID, Name, Gender, Address)
Teaching_staff (ID, Name, Gender, Address)
Student (PRN, Name, Age, Address, Gender)
Books (BookID, Name, Author)
Course (Year, Subjects)
Marks (PRN, Test1, Test2, Final)

ER-Diagram:
1. Student database ER diagram
2. Company Database ER diagram

3. Bank Database:

4. College Database:
Schema :
1. Comapany
Employee

SSN Fname Lname Address Sex Salary Supervision DNO

Department

DNO Dname MgrSSN MgrStartdat


e
DLocation

DNO DLOC

Project

PNO Plocation Pname DNO

Work on

SSN PNO Hours

2. Student:
Student
PRN Name Address Gender
Semester
SSID Semester Section
Class
PRN SSID
Subject
SubjectCode Title Semester Credits
Marks
PRN SubjectCode Test1 Test2 Final

3. Bank
Bank
IFSC Code Name Address Telephone
Staff
ID Name Salary Telephone Address Age
User
AccountNo Name Address Telephon AdharNo AccountType DOB Balance
e

4. College
College
RegNo Name Address Telephone
Office_Staff
ID Name Address Gender
Teaching_Staff
ID Name Address Gender
Student
PRN Name Address Telephone Age
Books
BookID Name Author
Course
Year Subjects
Conclusion:
In this practical we learned about various attributes and the components of ER diagram. We drew ER
diagrams for college, student, company and bank.

Questions:
1. What is an ER Diagram?
An ER diagram is a graphical representation of an entity relationship model. It is used to
represent the relationships between entities in a database.

2. Can you explain the different symbols used in an ER diagram?


The three most common symbols used in an ER diagram are rectangles, diamonds, and ovals.
Rectangles are used to represent entities, while diamonds represent relationships between
those entities. Ovals are used to represent attributes.

3. Why are composite keys important when modeling databases with entity-relationship
diagrams?
Composite keys are important when modeling databases with entity-relationship diagrams
because they can help to uniquely identify each row in a table. This is especially important
when modeling databases that will be used for transactional purposes, such as online stores.
By using a composite key, you can ensure that each row in the database is uniquely identified,
which can help to prevent errors during transactions.

4.  How can cardinality be applied to relationships in ER diagrams?


Cardinality is a way of representing the minimum and maximum number of occurrences of an
entity in a relationship. For example, if you have a relationship between two entities, A and B,
and you want to indicate that A can be related to B multiple times, you would use a cardinality
of 1:N.

5. What is normalization?
Normalization is the process of organizing data in a database so that it meets certain
requirements, in order to reduce data redundancy and improve data integrity.

Name & Sign of Course Teacher


Mr. Vinit Kakde

You might also like