0% found this document useful (0 votes)
20 views8 pages

Scenerio Er - Uml, Relational

Uploaded by

JABBAR ALTAF
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)
20 views8 pages

Scenerio Er - Uml, Relational

Uploaded by

JABBAR ALTAF
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/ 8

NUML UNIVERSITY, H-9, Islamabad

Database Systems Theory


Instructor Name: Aysha Safdar
(Lecturer CS, NUML,H-9, ISL)

Note: These practice questions are in details in which all things


are mentioned even relationship. However, you have to identify
relationships by yourselves and make ER Diagram, UML and
convert to relations according to your identified criteria.

Case Study:

Relational Tables

Below is the schema derived from the ER diagram:


NUML UNIVERSITY, H-9, Islamabad

1. Customer

Attribute Description
C_ID (Primary Key) Unique customer identifier
Name Customer name
DOB Date of birth
ContactNo Contact number
House_no House number
Street Street name
Dependant_name Name of dependent

2. Employee

Attribute Description
E_ID (Primary Key) Unique employee identifier
Name Employee name

3. Branch

Attribute Description
Branch_ID (Primary Key) Unique branch identifier
Branch_Name Name of the branch

4. Loan

Attribute Description
Loan_No (Primary Key) Unique loan identifier
Amount Loan amount
Borrower_ID (Foreign Key) References Customer(C_ID)
Branch_ID (Foreign Key) References Branch(Branch_ID)

5. Loan_Payment

Attribute Description
Payment_ID (Primary Key) Unique payment identifier
Loan_No (Foreign Key) References Loan(Loan_No)
NUML UNIVERSITY, H-9, Islamabad

Payment_Amount Payment amount


Payment_Date Date of payment

6. Account

Attribute Description
AccountNo (Primary Key) Unique account identifier
Balance Account balance
Customer_ID (Foreign Key) References Customer(C_ID)
Interest_Rate Interest rate for the account

7. Saving Account

Attribute Description
AccountNo (Primary Key & Foreign References
Key) Account(AccountNo)
Daily_withdraw_limit Daily withdrawal limit

8. Current Account

Attribute Description
AccountNo (Primary Key & Foreign References
Key) Account(AccountNo)
Overdraft_Amount Maximum overdraft allowed
Per_Transaction_Charges Transaction fees

Relationships

1. Customer and Loan: A customer can borrow multiple loans


(1:N relationship).
2. Loan and Loan Payment: A loan can have multiple payments
(1:N relationship).
3. Customer and Account: A customer can have multiple
accounts (1:N relationship).
4. Account Types: Accounts can be either a Savings Account or a
Current Account (IS A relationship).
NUML UNIVERSITY, H-9, Islamabad

5. Employee and Loan: A loan can be managed by multiple


employees (M:N relationship).

Online Retail Store Management System

You are hired by an online retail company to design a database


system for managing its operations. The company needs to keep
track of customers, products, orders, payments, and the
employees managing the operations. Here’s the detailed scenario:

Entities and Their Descriptions

1. Customer:
o Each customer has a unique ID, name, email, phone
number, and address.
o A customer can place multiple orders.
2. Product:
o The company sells a variety of products.
o Each product has a unique product ID, name, description,
price, and stock quantity.
3. Order:
o Customers place orders for one or more products.
o Each order has a unique ID, order date, and total amount.
o Each order is associated with one customer.
4. Order Line Item:
o An order can contain multiple products, with details
about the quantity ordered for each product.
5. Payment:
o Each order must be paid for.
o Payments include a payment ID, date, amount, and
payment method (e.g., credit card, PayPal).
o A single order may have one payment, but customers can
make multiple payments across different orders.
6. Employee:
NUML UNIVERSITY, H-9, Islamabad

o The system tracks employees who manage the store and


fulfill orders.
o Each employee has a unique ID, name, position, and
department.
o Employees may assist in handling multiple orders.

Relationships

1. Customer and Order:


o A customer can place multiple orders, but an order
belongs to only one customer.
2. Order and Product:
o An order can include multiple products, and a product
can appear in multiple orders (many-to-many
relationship). Use an Order Line Item entity to resolve
this relationship.
3. Order and Payment:
o An order can have one payment.
4. Employee and Order:
o An employee can assist in handling multiple orders, but
an order can only be managed by one employee.

Tasks for Practice

1. Create an ERD Diagram:


o Using the scenario described above, create an Entity-
Relationship Diagram (ERD) to visually represent the
entities, their attributes, and relationships.
2. Create a UML Diagram:
o Design a UML Class Diagram for the scenario, ensuring
that you represent classes, their attributes, and
associations between them.
3. Convert the ERD into Relational Tables:
o Using the ERD, create relational tables for all entities.
NUML UNIVERSITY, H-9, Islamabad

o Clearly define primary keys, foreign keys, and


relationships.

Student Management System

You have been approached by a university to design a Student


Management System to efficiently manage information related to
students, courses, instructors, departments, and enrollments.
The system will also track grades and the relationships between
these entities. Below is a detailed description of the requirements:

1. Student:
o Each student has a unique Student ID, full name, date of
birth, gender, contact number, and address.
o A student can enroll in multiple courses during a
semester.
2. Course:
o Courses offered by the university are uniquely identified
by a Course ID.
o Each course has a name, description, and number of
credits.
o A course is associated with a department, and multiple
courses can belong to the same department.
3. Instructor:
o Instructors teach courses.
o Each instructor has a unique Instructor ID, full name,
qualification, and specialization.
o An instructor may teach multiple courses, and a course
can be taught by one or more instructors.
4. Department:
o Each department in the university is uniquely identified
by a Department ID.
o A department has a name and a head (one of the
instructors is the department head).
o A department manages multiple courses and instructors.
NUML UNIVERSITY, H-9, Islamabad

5. Enrollment:
o Students enroll in courses for a specific semester.
o Enrollment has attributes like Semester, Year, and Grade
(e.g., A, B, C, etc.).
o A student can enroll in multiple courses, and a course can
have multiple students enrolled in it (many-to-many
relationship).
6. Grades:
o The system needs to store grades for each student in
every course they enroll in.
o Grades are associated with specific enrollments.

Tasks for Practice

1. Create an ERD Diagram:


o Use the scenario described above to design an Entity-
Relationship Diagram (ERD) that includes:
 All entities (e.g., Student, Course, Instructor,
Department, Enrollment).
 Attributes for each entity.
 Relationships with cardinality (e.g., 1:N, M:N).
2. Create a UML Class Diagram:
o Design a UML Class Diagram to represent:
 Classes for each entity, including attributes.
 Associations between classes with multiplicities.
3. Convert the ERD into Relational Tables:
o Define relational tables for all entities and relationships
from the ERD.
o Clearly identify Primary Keys (PK) and Foreign Keys
(FK).
o Resolve many-to-many relationships (e.g., Enrollment)
using join tables.

Relationships
NUML UNIVERSITY, H-9, Islamabad

1. Student and Enrollment:


o A student can enroll in multiple courses, but an
enrollment belongs to one student.
2. Course and Enrollment:
o A course can have multiple students enrolled, but an
enrollment is linked to one course.
3. Course and Instructor:
o A course can be taught by multiple instructors, and an
instructor can teach multiple courses (many-to-many
relationship).
4. Course and Department:
o A course belongs to one department, but a department
can manage multiple courses.
5. Instructor and Department:
o An instructor belongs to one department, but a
department can have multiple instructors.
6. Grades:
o Grades are recorded for each enrollment (specific student
in a specific course).

You might also like