Assignment 2 QP
Assignment 2 QP
Instructions to Students:
Read the problem statement, functionality and the other details provided carefully
and implement the solution.
Note:- Run the CreateDB.sql file to create tables and data automatically.
Provide all the solution queries in a file dbms_sol.sql file and upload it.
A business scenario
A well known college “ABC XYZ TS College” has the following tables to keep track of its
operations:
1. student
2. professor
3. subject
4. department
The student table provides the details of all the students studying in the college.
Table: student
The department table provides the details of all departments in the college.
Table: department
subject VARCHAR(8) FOREIGN KEY Subject code referring to subject table, subject
taught by professor
The subject table lists all the subjects supposed to be taught in the college.
Table: subject
A. Display the roll number, full name and date of birth of those student(s) whose
first name 3rd character is ‘n’ (e.g. Sunil Kumar) display date of birth in DD-MM-
YY format in a column named DOB.
B. Display department name and the total number of professors that are under
every department. If no professors are there in a department, then do not display
anything for that department in the output.
C. Display the department code and name of those departments whose length of name is
between 25 and 35 characters.
D. Display the department name, address and number of subjects associated with that
department for which the number of subjects offered is maximum. If the address is not
available, i.e., NULL, display it as 'N/A'.
E. Display the subject code and name of the subjects along with the count of professors
for which teachers are available.
F. Display the subject details for all the subjects which are taught by professors from
departments different from the departments which offer the course.
G. Display the subject names in the ascending order of the department name which offers
it.
H. Display roll no, full name and city of those students whose city has more than one word.
(e.g. New Delhi)
I. Display the name of the student who is the oldest in the college among those whose
date of birth is available.
J. Display the name of the department and number of professors for the department
that has the third maximum number of professors available across departments.