DBMS Lab-7
DBMS Lab-7
LAB 7
REPORT
1.
SELECT Name
FROM Students
ORDER BY GPA DESC
LIMIT 3;
2.
SELECT c.CourseName, COUNT(e.StudentID) AS EnrollmentCount
FROM Courses c
LEFT JOIN Enrollments e ON c.CourseID = e.CourseID
GROUP BY c.CourseID, c.CourseName
ORDER BY EnrollmentCount DESC;
3.
SELECT Name
FROM Students
WHERE StudentID NOT IN (
SELECT DISTINCT StudentID
FROM Enrollments
);
4.
SELECT s.Name AS StudentName, c.CourseName
FROM Students s
CROSS JOIN Courses c
WHERE s.GPA > 3.5;
5.
SELECT s.Name
FROM Students s
JOIN Enrollments e ON s.StudentID = e.StudentID
GROUP BY s.StudentID, s.Name
HAVING COUNT(e.CourseID) > 1;
6.
SELECT s.Name, s.Department, s.GPA
FROM Students s
WHERE s.GPA = (
SELECT MAX(GPA)
FROM Students
WHERE Department = s.Department
);