0% found this document useful (0 votes)
124 views21 pages

Bba Second Semester

The document describes Entity Relationship (ER) diagrams and their components. It provides examples of ER diagrams modeling different types of relationships between entities such as one-to-one, one-to-many, many-to-one, and many-to-many relationships. It also includes ER diagram examples for relationships between customers and loans, vehicles and accidents in a car insurance system, buses and passengers in a transportation system, drivers and buses in a transportation ticketing system, and entities in a university registrar's office system.

Uploaded by

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

Bba Second Semester

The document describes Entity Relationship (ER) diagrams and their components. It provides examples of ER diagrams modeling different types of relationships between entities such as one-to-one, one-to-many, many-to-one, and many-to-many relationships. It also includes ER diagram examples for relationships between customers and loans, vehicles and accidents in a car insurance system, buses and passengers in a transportation system, drivers and buses in a transportation ticketing system, and entities in a university registrar's office system.

Uploaded by

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

BBA SECOND SEMESTER

SUBMITTED BY: SUBMITTED TO:


PRAGATI ARYAL MR.BIJAY MAHARJAN
ROLL NO: 22 (COMPUTR SIR)
Contents
1. ER-diagram
2. Structured Query Language
Entity Relationship Diagram
An entity relationship diagram(ER-diagram) is a specialized
graphical tool that demonstrate the interrelationships among
various entities of a database. It is used to represent the
overall structure of the database.

Symbols Used in ER Diagram


 RECTANGLE represent entity sets. E
 DIAMONDS represent relationship sets.
R
 LINES links attributes to entity sets and entity sets to
relationship sets.

 ELLIPSE represent attributes. A

 DOUBLE ELLIPSE represent multi-valued attributes.

 DASHED ELLIPSE denoted derived attributes.

A
 UNDERLINE indicates primary key attributes.

A
 DOUBLE LINES indicates total participation of an entity
set in a relationship set.

 DOUBLE RECTANGLE represent weak entity sets. E

 DOUBLE DIAMONDS represent identifying relationship


set for weak entity set.
R

 DISCRIMINATING ATTRIBUTE OF A WEAK ENTITY SET A

 SPECIALIZATION OR GENERALIZATION ISA


a

 TOTAL GENERALIZATION ISA


a
ER-DIAGRAMS
1. Draw an ER diagram corresponding to customer and loan entity set.

CID LID AMOUNT


NAME

CUSTOMER BORROW LOAN

2. Draw an ER diagram showing composite attributes and multi-variable


attributes corresponding of customer and loan entity set.
Vehicle loan
Home loan

Middle name
First name

Last name Loan type

CID LID AMOUN


NAME
T

CUSTOMER BORROW LOAN

D.O.B
CONTACT
3. Draw an ER diagram showing one-to-one relationship.
LID AMOUNT
CID NAME

CUSTOMER BORROW LOAN

4. Draw an ER diagram showing one-to-many relationship.

CID NAME LID AMOUNT

BORROW LOAN
CUSTOMER

5. Draw an ER diagram showing many-to-one relationship.


NAME AMOUN
CID LID
T

CUSTOMER BORROW LOAN

6. Draw an ER diagram showing many-to-many relationship.

AMOUNT
CID LID
NAME

CUSTOMER BORROW LOAN


7. Draw an ER diagram for a car insurance company whose customer own
one or more cars each. Each car has associated with zero to any number
of recorded accident. Assume attributes of your own interest.
CID NAME LID AMOUN
T

CUSTOMER Owns Car

Recorded

Accident

accno Date

8. Consider a transportation system has buses, passenger and route, a bus


travel in one route and a number of buses can travel in same route. Bus
is described by bus-no (unique), model, color etc. Route is described by
route-id (unique), distance, rate (based on distance). A passenger is
assigned to only one bus as bus may have many passengers. Passengers
are described by pid (unique), name, address, age, sex. Draw an ER
diagram to model this system .
Color Route-id
Model Rate
Bus-no
Model

Buses Travel Car

Carry

Passenger
Age

pid

Sex

Name

Address

9. Make an ER diagram on the basis of following scenario. This is system


where information about drivers, bus, tickets and customer are stored.
Driver drive bus, customer travel from one place to another by a bus.
Driver checks the ticket of each customer ID, name, contact-no and age.
Each bus has unique bus number, its capacity and type. Tickets have
sources, destination, price and date. Driver has driver-id, name, age,
address. Each customer must have ticket to travel by the bus.
Address Age Bus-no
Capacity Rate
Driver-id

Name

Driver Drives Bus

Checks Travel

Tickets Must have Customer

Price Name
Source
CID

Date Age
Destination
Contact-no

10.Consider the following relationship


Computer [co.no, price]
Student [Roll-no, name, grade]
Faculty [Fname, credit-hours]
User [co.no, Roll-no]
Belongs [co.no, Fname]
Make an ER diagram for above relationship
Grade co.no Price
NAME
Roll-no

Student Uses Computer

Belongs

Faculty

Fname Credit-hr

11. Consider the following relationship:


Employee [EID, Name, Post-title, Age]
Name
Post [Post-id, Salary]
Post-title
Project [Pid, Duration, Budget]
Work [Pid, EID]
IS [Post-id, EID] Age
EID
Make an ER diagram
Post-id
Salary

Post IS Employee

Duration
Pid Work

Budget Project
12.Draw an ER diagram for college registrar’s office, a college office
maintain data about the following entities
Course [Number, Title, Credit, Course-id]
Student [Sid, Name, Program]
Instructor [Number, Name, Department]
Courses are taught by instructor and student are enrolled in different
Title
courses
Program Number Credit
NAME
Sid
Course-id

Student Enrolled Courses

Name
Taught
Department

Instructor

13.A University registrar’s office maintain data about following entities


Courses including [Cno, Title, Syllabus]
Courses offering including course no, semester, section, timing.
Student including Sid, Name, Program.
Instructor including id-no, Name, Department and Title.
Further, the enrollment of the student in course and grades awarded to
students in each course they are enrolled for must be appropriately
modeled. Construct an ER diagram for the registrar’s office
Program Cno
Title Syllabus
Sid Name

Student Involves Course including

Teaches By university

Instructor To Course offering

Title Section
id-no Course-no

Name Timing
Departmen
t Semester

14.A company database need to store information about employee


identified by Cno, with salary attributes. Department identified by Dno,
with Dname and budget attribute and children of employee with Name,
Age attribute. Employee work in department, each department is
managed by an employee, a child must be identified uniquely by name
when the parent (who is an employee). Assume that only one parents
works for the company is known. Draw an ER diagram that capture the
above information.
Name Eno Salary
Budget
Dno

Department Managed Employee

Age Have

Name
Children of employee

15.Consider a hospital system including Doctor, Nurse and patient as


entity. A doctor may treat many patient in the hospital and a patient
may be treated by many doctor. Nurse helps doctor in treatment
process. Draw an ER diagram for above scenario.

Name Id
Name Roomid
Dno
Field

Doctor Treats Patient

Help
Nid

Shift
Nurse
16.Draw an ER diagram showing one-to-one relationship between Bank
and CEO.
Bname Level ID Name

Bank Has CEO

17.Draw an ER diagram showing one-to-many relationship between child


and mother.

MID NAME CID


Sex

Has Children
Mother

18.Draw an ER diagram showing many-to-one relationship between book


and publisher.

Pno Location
BID Price

Published
Book Publisher
by

19.Make an ER diagram with the help of following entities and attributes.


Customer borrow loan from bank and paid a loan. Customer has CID,
Name, Address, Contact, age and sex. Loan has LID, date and amount.
Name Amount
LID
CID Address

20.

Borrows Loan
Customer

Age

Sex

Loan
Contact payment

Payment

Payment no

Date

20. Make an ER diagram showing customer pay loan in a bank. Assume


the attribute by yourself.
Payment no Date
LID Amount

Loan Loan
Payment
payment
SUBCLASS AND SUPER CLASS

21.Consider the example of entity set college and draw an ER diagram


representing superclass/subclass relationship by using ISA triangle.

Level
Name
Location

College

Type
#Faculty
ISA

Constituent College ISA Affiliated College

Permanently affiliated Temporarily affiliated


College College

SPECIALIZATION AND GENERALIZATION


22.Draw an ER diagram with specialization.
Address
Pname

Person
Credit-rating

Salary
ISA

Employee Customer

ISA
Office-no
Typing-speed

Officer
Teller
Typist

Station-no

SPECIALIZATION
23.Draw an ER diagram with generalization.
GENERALIZATION
Publication
Author
Price

Tech-media

Size
Pages
ISA

Book CD

24.Draw an ER diagram showing disjoint constraint.

Title
Price

Book

Size
Pages DISJOINT
ISA

Paperback book Electronic Book


25.Draw an ER diagram showing overlapped constraint.

Title Duration

Movie
Fight master
Type
OVERLAPPED
ISA

Action movie Comedy movie


Standard Query Language
First version of SQL was developed by IBM by Donald D. Chamberlin
and Raymond F.Boyle in early 1970s.This version initially called
Sequel was designed to manipulate and retrieve data stored in IBM
originally relational database product. The SQL language was later
formally standardized by the American National Standard Institute
(ANSI) IN 1986.
SQL is a database language designed for the retrieval and
management of data in Relational Database Management System
(RDBMS) database schema creation and modification and database
object access control management.

You might also like