You are on page 1of 3

CSE250 Database Management System

Winter Semester 2022


Assignment-2

Submission Date: February 20, 2022

Instructions for Submission:

You will be uploading your assignment in a single word file/notepad file on LMS.
No need to paste screenshots. Paste only commands.

----------------------------------------------------------------------------------------------------
Following is a Bank Schema (Tables and Relationships). Create all the tables with appropriate
Primary and Foreign keys.

Write select statements to answer the following questions.

1. Display names of the customers who have account in the city where they live.
2. Display details of customers who are not borrower.
3. Display customer details who have taken loan more than 3 times.
4. Display pairs of customers who live in the same city.
5. Display details of the customers whose name is the longest.
6. Display details of borrowers who have taken loan from 'Ahmedabad' branch.
7. Display details of borrowers who have taken total loan of more than Rs. 50,00,000.
8. Display total assets of all the branches.
9. Display details of customers who are depositors.
10. Display left outer join of customer and depositor table.
11. Display right outer join of account and depositor table.
12. Display account number in which balance is minimum.
13. Display account number in which balance is second highest.
14. Display branch name, branch city, account number, customer name and customer city in
ascending order of customer city and descending order of branch city.
15. Display total no. of customers in each city.
16. Display city wise total assets in descending order of total assets.
17. Display borrower names with total loan amount taken.
18. Display details of the customers who are depositors as well as borrower.
19. Display inner join of customer, borrower, loan and branch.
20. Display union of branch and account. (Use “union” operator)
Write DML (Insert/Update/Delete/Select) statements to answer the following questions.

1. Create a new course “CS-001”, titled “Weekly Seminar”, with 2 credits.


2. Create a section of the course “CS-001” in Monsoon 2019, with sec_id of 1.
3. Enroll every student in the Comp. Sci. department in section 1.
4. Delete enrollment in section 1 where student name is Chiral.
5. Delete all “takes” tuples corresponding to any section of any course with the word
“database” as a part of the title, ignore case when matching the word with the title.
6. Find courses in which students can enroll themselves without attending any course.
7. Find courses in which students have to complete at least two courses.
8. Display course names with total no. of prerequisites.
9. Display names of courses offered by the SEAS department.
10. Find faculty names who are teaching “data” based courses.
11. Display total no. of courses offered in the Monsoon Semester 2020.
12. Find semester name in which highest number of courses were offered.
13. Find names of courses offered on Saturdays in Winter semester 2022.
14. Display name of the student who has earned second highest credits.
15. Find course names with less than 10 enrolments for the Winter semester 2022.
16. Find semester wise and course wise total enrolments.
17. Find building names with highest no. of rooms.
18. Find least capacity room.
19. Display faculty name who has/is taught/teaching average 4 sections in Monsoon
semester 2021.
20. Change department of Gaurav Goswami and make it same as the department of Aditya
Vaishya.
21. Display time slot details of the course Database Management System.
22. Find room numbers which have capacity more than average capacity of all the rooms.
23. Find course names which were offered in the years 2020 and 2021.
24. Find department names where budget is spent is more than allocated budget.
25. Find classrooms which are available on Wednesdays during 1 pm to 2:30 pm.

*****

You might also like