0% found this document useful (0 votes)
4 views5 pages

ER Assignment

ER

Uploaded by

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

ER Assignment

ER

Uploaded by

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

Please draw ER diagram in your copies and bring it to college and get it signed.

I have included
the solution as well for the questions.

Question 1: Basic ERD for a University Database

Question: Design an ERD for a university system that includes the following entities and
relationships:

• Entities: Student, Course, Professor, and Department


• Relationships:
o Each student can enroll in multiple courses.
o Each course can have multiple students.
o Each course is taught by one professor.
o Each professor belongs to one department.

Solution:

1. Identify Entities and Attributes:


o Student: Attributes could include StudentID, Name, DOB, and Email.
o Course: Attributes could include CourseID, CourseName, and Credits.
o Professor: Attributes could include ProfessorID, Name, Email, and Office.
o Department: Attributes could include DepartmentID and DepartmentName.
2. Define Relationships:
o Enrolls: A many-to-many relationship between Student and Course because
each student can enroll in multiple courses, and each course can have multiple
students.
o Teaches: A one-to-many relationship from Professor to Course since each
course is taught by one professor, but a professor can teach multiple courses.
o Belongs: A one-to-many relationship from Department to Professor since each
professor belongs to one department, but a department can have multiple
professors.
3. Draw the ERD:
o Draw rectangles for each entity: Student, Course, Professor, Department.
o Draw diamonds for relationships: Enrolls, Teaches, Belongs.
o Connect the entities with lines to show relationships and mark cardinalities:
§ Student —(many) Enrolls (many)— Course
§ Professor —(one) Teaches (many)— Course
§ Department —(one) Belongs (many)— Professor

Question 2: ERD for an E-commerce System

Question: Design an ERD for an e-commerce system with the following entities and
relationships:
• Entities: Customer, Order, Product, and Supplier.
• Relationships:
o Each customer can place multiple orders, but each order is placed by one
customer.
o Each order can contain multiple products, and each product can be in multiple
orders.
o Each product is supplied by one supplier, but a supplier can supply multiple
products.

Solution:

1. Identify Entities and Attributes:


o Customer: Attributes could include CustomerID, Name, Email, and Address.
o Order: Attributes could include OrderID, OrderDate, and TotalAmount.
o Product: Attributes could include ProductID, ProductName, Price, and Stock.
o Supplier: Attributes could include SupplierID, SupplierName, and
ContactInfo.
2. Define Relationships:
o Places: A one-to-many relationship from Customer to Order because each
customer can place multiple orders, but each order is placed by one customer.
o Contains: A many-to-many relationship between Order and Product because
each order can have multiple products, and each product can appear in multiple
orders.
o Supplies: A one-to-many relationship from Supplier to Product because each
product is supplied by one supplier, but a supplier can supply multiple products.
3. Draw the ERD:
o Create rectangles for Customer, Order, Product, and Supplier.
o Draw diamonds for relationships: Places, Contains, and Supplies.
o Connect entities to show relationships with cardinalities:
§ Customer —(one) Places (many)— Order
§ Order —(many) Contains (many)— Product
§ Supplier —(one) Supplies (many)— Product

Question 3: ERD for a Library Management System

Question: Create an ERD for a library management system with the following entities and
relationships:

• Entities: Member, Book, Loan, Author.


• Relationships:
o Each member can borrow multiple books, but each loan is linked to one member.
o Each book can be borrowed multiple times, and each loan refers to one book.
o Each book can have multiple authors, and each author can write multiple books.
Solution:

1. Identify Entities and Attributes:


o Member: Attributes could include MemberID, Name, Address, and PhoneNumber.
o Book: Attributes could include BookID, Title, Genre, and PublicationYear.
o Loan: Attributes could include LoanID, LoanDate, and ReturnDate.
o Author: Attributes could include AuthorID, AuthorName, and Bio.
2. Define Relationships:
o Borrows: A many-to-many relationship between Member and Book through Loan
because each member can borrow multiple books, and each book can be borrowed
by multiple members.
o Writes: A many-to-many relationship between Author and Book because each
book can have multiple authors, and each author can write multiple books.
3. Draw the ERD:
o Draw rectangles for Member, Book, Loan, and Author.
o Draw diamonds for relationships: Borrows and Writes.
o Add an associative entity Loan between Member and Book to resolve the many-to-
many relationship.
o Show cardinalities:
§ Member —(one) Borrows (many)— Loan —(one) Borrows (many)— Book
§ Author —(many) Writes (many)— Book

Question 4: ERD for a Hospital Management System

Question: Design an ERD for a hospital management system including:

• Entities: Doctor, Patient, Appointment, Department.


• Relationships:
o Each doctor belongs to one department, but a department can have multiple
doctors.
o Each patient can book multiple appointments, and each appointment is booked by
one patient.
o Each appointment is associated with one doctor, and each doctor can have
multiple appointments.

Solution:

1. Identify Entities and Attributes:


o Doctor: Attributes could include DoctorID, Name, Specialization, and
PhoneNumber.
o Patient: Attributes could include PatientID, Name, Age, and Address.
o Appointment: Attributes could include AppointmentID, Date, and Time.
o Department: Attributes could include DepartmentID and DepartmentName.
2. Define Relationships:
WorksIn: A one-to-many relationship from Department to Doctor because each
o
doctor belongs to one department, but a department can have multiple doctors.
o Books: A one-to-many relationship from Patient to Appointment because each
patient can book multiple appointments, but each appointment is for one patient.
o Conducts: A one-to-many relationship from Doctor to Appointment because
each appointment is conducted by one doctor, but each doctor can have multiple
appointments.
3. Draw the ERD:
o Draw rectangles for Doctor, Patient, Appointment, and Department.
o Draw diamonds for relationships: WorksIn, Books, and Conducts.
o Connect the entities with lines to represent relationships and cardinalities:
§ Department —(one) WorksIn (many)— Doctor
§ Patient —(one) Books (many)— Appointment
§ Doctor —(one) Conducts (many)— Appointment

Question 5: ERD for a Hotel Management System

Question: Create an ERD for a hotel management system with the following entities:

• Entities: Guest, Room, Reservation, Employee.


• Relationships:
o Each guest can make multiple reservations, but each reservation is made by one
guest.
o Each reservation is for one room, but a room can be reserved multiple times.
o Each employee can manage multiple reservations, but each reservation is
managed by one employee.

Solution:

1. Identify Entities and Attributes:


o Guest: Attributes could include GuestID, Name, Email, and Phone.
o Room: Attributes could include RoomID, RoomType, Price, and Availability.
o Reservation: Attributes could include ReservationID, StartDate, EndDate, and
Status.
o Employee: Attributes could include EmployeeID, Name, Position, and
ContactNumber.
2. Define Relationships:
o Makes: A one-to-many relationship from Guest to Reservation because each
guest can make multiple reservations, but each reservation is for one guest.
o Books: A many-to-many relationship between Reservation and Room because
each reservation is for one room, but a room can be reserved multiple times. This
relationship might be simplified if a room is associated with only one reservation
at a time.
o Manages: A one-to-many relationship from Employee to Reservation because
each employee manages multiple reservations, but each reservation is managed by
one employee.
3. Draw the ERD:
o Draw rectangles for Guest, Room, Reservation, and Employee.
o Draw diamonds for relationships: Makes, Books, and Manages.
o Show cardinalities:
§ Guest —(one) Makes (many)— Reservation
§ Reservation —(many) Books (one)— Room
§ Employee —(one) Manages (many)— Reservation

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