Professional Documents
Culture Documents
Group 7 - Assignment 2
Group 7 - Assignment 2
Group 7 - Assignment 2
QUERY-1 :-
Find the name and rollNo of students who have their advisor as HOD of the department same as
the student and the advisor must have joined before 2000.
Firstly , we cross student , department and professor , then we apply the condition that the
student deptNo and departmentId match , check for the advisor id matching with the hod id
having start year > 2000.
QUERY-2 :-
Find the deptId and deptName of the departments which do not have any professor.
First get the deptNo of all the professors and select the complimentary set of the obtained
deptIds.
QUERY-3 :-
Find the name and rollNo of students who got atleast one U grade in the enrolled courses.
First cross the student , enrollment and course and then apply the conditions that the
studentdept and course deptNo match , student rollNo and enrollment rollNo match and the
grade is 'U'.
QUERY-4 :-
Find the name and rollNo of students who have not taken atleast one course in their respective
department.
select s1.rollNo
from student as s1 , enrollment as e , course as c
where s1.rollNo=e.rollNo and s1.deptNo=c.deptNo and e.courseId=c.courseId)
First find the students who have taken atleast one course in their respective department and
then finding the complement of that set of students gives the set of students who didnt take
atleast one course from their department.
QUERY-5 :-
Find the number of students who got S-grade in atleast one course in each department.
First find the departments with enrolled students getting S grade in its respective courses and
then grouping the departments together and finding the number of distinct rollNos in the
grouped data thus giving the number of students in each department who got atleast one S
grade in that department courses.
QUERY-6
Find the courses whose enrollment number has exceeded the classroom capacity(100) and need
larger halls in the current semester.
First find the count of the number of students enrolled in each course of the current semester
and then conditioning that the count is greater than 100.
QUERY-7 :-
Find the maximum enrollment in a particular course out of all semester of all the years.
QUERY-8 :-
Find the courseId , department name and the coursename of the courses in which the number of
males and females enrolled are equal.
group by c.cname);
where f.Females=m.Males;