0% found this document useful (1 vote)
348 views9 pages

Assignment 1

Uploaded by

jeyastephen07
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 (1 vote)
348 views9 pages

Assignment 1

Uploaded by

jeyastephen07
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/ 9

ASSIGNMENT- I DETAILS:

UNIT- I
CONCEPTUAL DATA MODELING
S. NO. QUESTIONS COs K Level
Case Study: University Course Registration System
Scenario
A university needs a system to manage course registrations. The
system should track information about students, courses, instructors,
departments, and enrollments.
Requirements
1. Entities:
 Students: Each student has a unique student ID, name, date of
birth, and major.
 Courses: Each course has a unique course ID, title, description,
and number of credits.
 Instructors: Each instructor has a unique instructor ID, name,
and department.
 Departments: Each department has a unique department ID,
name, and building location.
1  Enrollments: Each enrollment records the student, course, CO1 BTL-3
semester, and grade.
2. Relationships:
 A student can enroll in multiple courses.
 An instructor can teach multiple courses.
 Each course is offered by one department.
 Each instructor belongs to one department.
3. Constraints:
 A student cannot enroll in the same course more than once per
semester.
 An instructor can only teach courses offered by their
department.
Tasks
1. Identify the entities, attributes, and relationships.
2. Draw the ER diagram for the system.
3. Specify the primary keys, foreign keys, and any constraints.
Case Study: Library Management System
Scenario
A library needs a system to manage its operations, including tracking
books, members, loans, authors, and reservations.
2 Requirements CO1 BTL-3
1. Entities:
 Books: Each book has a unique book ID, title, ISBN,
publication year, and genre.
 Members: Each member has a unique member ID, name, date
of membership, and contact information.
 Loans: Each loan has a unique loan ID, loan date, and return
date.
 Authors: Each author has a unique author ID, name, and
nationality.
 Reservations: Each reservation has a unique reservation ID,
date, and status.
2. Relationships:
 A book can have multiple authors.
 A member can borrow multiple books.
 A member can reserve multiple books.
 A book can be reserved by multiple members.
3. Constraints:
 A loan must be associated with one member and one book.
 A reservation must be associated with one member and one
book.
Tasks
1. Identify the entities, attributes, and relationships.
2. Draw the ER diagram for the system.
3. Specify the primary keys, foreign keys, and any constraints.
Design an ER diagram for a comprehensive system (e.g., a university
campus management system, an airline reservation system, or an e-
3 commerce platform). Present your ER diagram and explain the CO1 BTL-3
rationale behind your design choices, including the entities,
relationships, attributes, and constraints.
Compare and contrast the ER model with other data modeling
4 techniques such as UML class diagrams and Object-Role Modeling CO1 BTL-2
(ORM). Discuss the advantages and disadvantages of each approach.
Explain the concepts of specialization and generalization in the ER
5 model. Illustrate these concepts with an ER diagram for an employee CO1 BTL-2
management system where employees can be classified as Full-Time
or Part-Time.
Case Study: Online Shopping System
Scenario
An online shopping platform needs a database to manage its
operations. The system should track customers, products, orders,
payments, and reviews.
Requirements
1. Entities:
 Customers: Each customer has a unique customer ID, name,
email, and shipping address.
 Products: Each product has a unique product ID, name,
6 description, price, and stock quantity. CO1 BTL-3
 Orders: Each order has a unique order ID, date, and status.
 Payments: Each payment has a unique payment ID, date,
amount, and payment method.
 Reviews: Each review has a unique review ID, rating,
comment, and date.
2. Relationships:
 A customer can place multiple orders.
 An order can contain multiple products.
 A product can be reviewed by multiple customers.
 A customer can make multiple payments for different orders.
3. Constraints:
 An order must have at least one product.
 A review must be associated with an existing product.
Tasks
1. Identify the entities, attributes, and relationships.
2. Draw the ER diagram for the system.
3. Specify the primary keys, foreign keys, and any constraints.
Case Study: Hospital Management System
Scenario
A hospital needs a database system to manage patient records, doctors,
appointments, treatments, and medical tests.
Requirements
1. Entities:
 Patients: Each patient has a unique patient ID, name, date of
birth, and contact information.
 Doctors: Each doctor has a unique doctor ID, name,
specialization, and contact information.
 Appointments: Each appointment has a unique appointment
ID, date, time, and status.
 Treatments: Each treatment has a unique treatment ID, name,
description, and cost.
8  Medical Tests: Each test has a unique test ID, name, CO1 BTL-3
description, and cost.
2. Relationships:
 A patient can have multiple appointments.
 A doctor can have multiple appointments with different
patients.
 An appointment can include multiple treatments.
 A patient can undergo multiple medical tests.
3. Constraints:
 An appointment must involve one patient and one doctor.
 A treatment can be associated with multiple appointments.
 A medical test must be prescribed for a patient.
Tasks
1. Identify the entities, attributes, and relationships.
2. Draw the ER diagram for the system.
3. Specify the primary keys, foreign keys, and any constraints.
Design an EER diagram for a hospital management system that
includes patients, doctors, departments, and appointments. Use
9 specialization to differentiate between inpatient and outpatient CO1 BTL-3
services. Explain the EER concepts used and how they are applied to
represent the hospital’s data.
Case Study: Vehicle Rental System
Scenario
A vehicle rental company needs a system to manage its rentals,
vehicles, customers, and payments.
Requirements
10 1. Entities:
CO1 BTL-3
 Customers: Each customer has a unique customer ID, name,
driver’s license number, and contact information.
 Vehicles: Each vehicle has a unique vehicle ID, make, model,
year, and rental rate.
 Rentals: Each rental has a unique rental ID, start date, end date,
and status.
 Payments: Each payment has a unique payment ID, amount,
date, and payment method.
2. Relationships:
 A customer can rent multiple vehicles.
 A vehicle can be rented multiple times.
 A rental can have multiple payments.
3. Constraints:
 A rental must be associated with one customer and one
vehicle.
 A payment must be associated with one rental.
Tasks
1. Identify the entities, attributes, and relationships.
2. Draw the ER diagram for the system.
3. Specify the primary keys, foreign keys, and any constraints.
Design a database for an automobile company to provide to its dealers
to assist them in maintaining customer records and dealer inventory
and to assist sales staff in ordering cars. Each vehicle is identified by
a vehicle identification number (VIN). Each individual vehicle is a
particular model of a particular brand offered by the company (e.g.,
the XF is a model of the car brand Jaguar of Tata Motors). Each model
11 can be offered with a variety of options, but an individual car may CO1 BTL-3
have only some (or none) of the available options. The database needs
to store information about models, brands, and options, as well as
information about individual dealers, customers, and cars.
Your design should include an E-R diagram, a set of relational
schemas, and a list of constraints, including primary-key and
foreign-key constraints.
Construct an E-R diagram for a car insurance company whose
customers own one or more cars each. Each car has associated with it
zero to any number of recorded accidents. Each insurance policy
12 covers one or more cars, and has one or more premium payments CO1 BTL-3
associated with it. Each payment is for a particular period of time, and
has an associated due date, and the date when the payment was
received.

UNIT - II
RELATIONAL MODEL AND SQL

S. NO. QUESTIONS COs K-Level

Create the following tables for a small e-commerce database:


Customers (CustomerID, Name, Email, Address)
Orders (OrderID, CustomerID, OrderDate, TotalAmount)
OrderItems (OrderItemID, OrderID, ProductID, Quantity, Price)
1 i) Write the SQL statements to create these tables, including CO2 BTL-3
primary keys, foreign keys, and any necessary constraints. Provide
sample data for each table.
ii) Alter the Orders table to add a Status column that can only have
values 'Pending', 'Shipped', or 'Delivered'. Write the SQL
statement to add this column and define a CHECK constraint to
enforce these values.
iii) List the customers who placed more orders.
Given the following schema for a bookstore database:
Books (BookID, Title, Author, Price, Stock)
Write SQL queries to:
i) Retrieve all books with a price greater than $20.
2 ii) Increase the price of all books by 10%. CO2 BTL-3
iii) Delete books that are out of stock.
iv) Find the total number of books in stock.
v) List the top 5 most expensive books.
vi) Retrieve the titles and prices of books written by a specific
author, sorted by price in descending order.
Given the tables
Students (StudentID, StudentName, Major, GPA) and
Enrollments (EnrollmentID, StudentID, CourseID, Grade)
i) write a SQL query to find the average GPA of students enrolled
in a particular course.
ii) Write a SQL query to list the top 5 students with the highest
GPAs. Include their names and GPAs.
iii) Update the Major of students in the Students table who have a CO2 BTL-3
3
GPA greater than 3.5 to 'Honors Program'. Write the SQL
statement for this update.
iv) Write a SQL query to retrieve the names of students who have
not enrolled in any courses. Assume Courses table (CourseID,
CourseName) and that an Enrollments table exists.
v) Delete records from the Enrollments table where the Grade is
NULL and the EnrollmentDate is more than two years old.
Given the tables Patients (PatientID, PatientName, DOB,
InsuranceID) and Appointments (AppointmentID, PatientID,
DoctorID, AppointmentDate), write a SQL query to find the number
of appointments each doctor has in the past month.

i) Write a SQL query to list all patients (Patients table) who have
not had any appointments in the last 6 months.
4 ii) Update the InsuranceID of patients in the Patients table to a CO2 BTL-3
new insurance provider if their current insurance provider is
'OldInsuranceCo'.
iii) Delete all appointment records from the Appointments table
where the AppointmentDate is more than 5 years old.
iv) Write a SQL query to find the total number of patients in each
age group (e.g., 0-18, 19-35, 36-50, 51+) based on their DOB
in the Patients table.
Given the tables Books (BookID, Title, AuthorID, Genre,
AvailableCopies) and BorrowRecords (RecordID, BookID,
BorrowerID, BorrowDate, ReturnDate), write a SQL query to find the
most frequently borrowed books in the last year.

i) Write a SQL query to list all authors (Authors table with


AuthorID, AuthorName) who have written more than 3 books
(Books table). Include their names.
ii) Update the AvailableCopies column in the Books table based
5 on the number of copies borrowed and returned. Assume you BTL-3
CO2
have a Transactions table with TransactionID, BookID,
Quantity.
iii) Delete records from the BorrowRecords table where the
ReturnDate is more than 2 years old and the book was not
returned.
iv) Write a SQL query to find all borrowers (Borrowers table with
BorrowerID, BorrowerName) who have never borrowed more
than 5 books in total.

Consider the following relational schema:


Employee(empno,name,office,age)
Books(isbn,title,authors,publisher)
Loan(empno,isbn,date)
Write SQL queries for the following
i) Find the names of employees who have borrowed a book
6 Published by XYZ Ltd., CO2 BTL-3
ii) Find the names of employees who have borrowed all books
Published by XYZ Ltd.,
iii) Find the names of employees who have borrowed more than five
different BOOKS Published by XYZ Ltd.,
iv) For each Publisher, find the names of employees who have
borrowed more than five books of that Publisher.
Consider the following relations :
Sailors (sid:integer, sname:string, rating:integer, age:real)
Boats (bid:integer, bname:string, color:string)
Reserves(sid:integer, bid:integer, day:date)
7 Write the SQL statement for the following queries : CO2 BTL-3

i) Find all sailors with a rating above.


ii) Find the sids of sailors who have reserved a red boat.
iii) Find the colors of boats reserved by lubber.
iv) Find the names of sailors who have reserved at least one boat.
Consider the employee database,
employee (employee name, street, city)
works (employee name, company name, salary)
company (company name, city)
8 manages (employee name, manager name) CO2 BTL-3
where the primary keys are underlined. Give an expression in SQL for
each of the following queries.
i) Find the names and cities of residence of all employees who
work for “First Bank Corporation”.
ii) Find the names, street addresses, and cities of residence of all
employees who work for “First Bank Corporation” and earn more than
$10,000.
iii) Find all employees in the database who do not work for “First
Bank Corporation”.
iv) Find all employees in the database who earn more than each
employee of “Small Bank Corporation”.
v) Assume that the companies may be located in several cities.
Find all companies located in every city in which “Small Bank
Corporation” is located.
Create the following tables,
Event (eventid, name, description,city)
Participant (playerid, name, eventid, gender, year)
Prizes (prizeid, prize-money, eventid, rank,year)
Winners (prizeid, playerid)
9 i) Choose appropriate primary keys and foreign keys for the tables. CO2 BTL-3
Playerid should contain at least one digit character.
ii) Retrieve the name of events where all prize winners are females
iii) Create a non-updatable view to retrieve the names of all
participants who won 1st prizes alongwith their event names
v) Write a trigger to make sure that for every new event created, 3
prizes are created in prizes table.(1st prize - 1500, 2nd - 1000, 3rd 500)
Consider the employee database,
employee (employee name, street, city)
works (employee name, company name, salary)
company (company name, city)
manages (employee name, manager name)
where the primary keys are underlined. Give an expression in SQL for
each of the following queries.
i) Assume that the companies may be located in several cities.
10 Find all companies located in every city in which “Small Bank CO2 BTL-3
Corporation” is located.
ii) Find the company that has the most employees.
iii) Find those companies whose employees earn a higher salary, on
average, than the average salary at “First Bank Corporation”.
iv) Give all employees of “First Bank Corporation” a 10 percent
raise.
v) Give all managers of “First Bank Corporation” a 10 percent
raise.

UNIT- III
RELATIONAL DATABASE DESIGN AND NORMALIZATION
S. NO. QUESTIONS COs K-Level
Consider the following ER diagram:

Entities: Employee (EmployeeID, Name, Position), Department


(DepartmentID, DepartmentName)
1 CO3 BTL-3
Relationships: WorksIn (EmployeeID, DepartmentID, StartDate)

Map this ER diagram to a relational schema. Include primary keys,


foreign keys, and any constraints necessary.
Consider the following ER diagram:

Entities: Customer (CustomerID, Name)

2 Weak Entity: Order (OrderID, OrderDate) with partial key OrderID CO3 BTL-3
and CustomerID as a foreign key.

Map this ER diagram to a relational schema. Define primary keys and


foreign keys, and explain how the weak entity is handled.
Given the EER diagram with the following:

Superclass: Employee (EmployeeID, Name)

3 Subclasses: Manager (ManagerID, Department), Technician CO3 BTL-3


(TechnicianID, Skill)

Map this EER diagram to a relational schema using generalization.


Create tables for the superclass and subclasses, and define primary
keys and foreign keys.
Given the EER diagram:

Category: Vehicle (VehicleID, VehicleType)

4 Subcategories: Car (CarID, CarModel), Truck (TruckID, CO3 BTL-3


TruckCapacity)

Map this EER diagram to a relational schema using categories. Define


tables for the category and subcategories, and specify primary keys
and foreign keys.
Consider the following EER diagram:

Superclass: Person (PersonID, Name)

Specializations: Student (StudentID, Major), Professor (ProfessorID,


5 Department) CO3 BTL-3

Map this EER diagram to a relational schema using specialization.


Define tables for the superclass and each specialized class, and specify
primary and foreign keys.
Given the following ER diagram:

Entities: Student (StudentID, Name, DOB), Course (CourseID,


CourseName)
6 CO3 BTL-3
Relationship: Enrollment (StudentID, CourseID, EnrollmentDate)

Map this ER diagram to a relational schema. Define primary keys and


foreign keys for each table.
Given the ER diagram:
7 CO3 BTL-3
Superclass: Person (PersonID, Name)
Subclasses: Patient (PatientID, MedicalHistory), Doctor (DoctorID,
Specialty)

Map this ER diagram to a relational schema using generalization.


Define tables for the superclass and subclasses, and specify primary
keys and foreign keys.
Given the ER diagram:

Entities: Book (BookID, Title), Author (AuthorID, AuthorName)

8 Aggregation: Authorship (BookID, AuthorID, BTL-3


ContributionPercentage) CO3

Map this ER diagram to a relational schema. Explain how the


aggregation Authorship is represented in the relational model. Define
primary keys and foreign keys.

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