Using the below University schema, write a SQL query that returns the LastName o
ID: 3757133 • Letter: U
Question
Using the below University schema, write a SQL query that returns the LastName of inactive students and faculty members. A student is inactive if he/she is not enrolled in any courses. A faculty member is inactive if he/she is not instructing any courses and is not serving as a department head Hint: Use CONCAT( FirstName, '",LastName) to get the full name of a faculty member Input Format The Students, Enrollments, Courses,Departments and Faculty table are defined as follows: Students Column Name Type VARCHAR(10) Firstame VARCHAR(255) VARCHAR(255) Department VARCHAR100) Netld LastNameExplanation / Answer
If you have any doubts, please give me comment...
SELECT LastName
FROM Students
WHERE NetId NOT IN(
SELECT NetId
FROM Enrollments
)
UNION
SELECT LastName
FROM Instructor
WHERE CONCAT(FirstName, ' ', LastName) NOT IN(
SELECT Instructor
FROM Courses
) AND CONCAT(FirstName, ' ', LastName) NOT IN(
SELECT DepartmentHead
FROM Department
);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.