Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In SQL, specifically running on Oracle, write the following query: \"Find the id

ID: 3886311 • Letter: I

Question

In SQL, specifically running on Oracle, write the following query: "Find the ids(s) and name(s) of the students who are not taking any course offered by any of the department(s) of which they are a major. "

Note: This must be done with a nested query. Creation of temporary tables to solve the problem is not permitted. It must be completed in a single query statment.

Based on the information provided, the correct output for the query should for the follow SID's and their corresponding SNAME value:
45678
70557
98765

Database Schema

Pertinent Table Information

I am only posting the Major, Student, and Enroll table since the other tables are not relevant for this specific problem.

MAJOR TABLE

STUDENT TABLE

ENROLL TABLE

dept(dname, numphds) course(cno, cname, dname) prof (pname, dname) section(cno, dname, sectno, pname) student(sid, sname, sex, age, gpa) major(sid, dname) enroll(sid, cno, dname, sectno, grade)

Explanation / Answer

Ans:

--> select SID,SNAME from STUDENT where SID=(select SID from MAJOR where MAJOR.SID!=ENROLL.SID);

From subquery we will get SID of MAJOR table where students who are not taking any course offered by any of the department(s) of which they are a major. from that we will get SID and SNAME of STUDENT table

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote