
Amedeo F. answered 11/06/20
SQL Server and Data Analytics Developer with 20 years experience
The following query will return a resultset desired for your first question, which is the names of all juniors who are enrolled in a class taught by Prof. Ram (using the DB Schema you provided):
Student (anum,shame,mainsubject,level,age)
Class(name,meetsat,room,fid)
Enrolled (anum,cname)
Faculty (fid,cname,deptid)
NOTE: I'm making two assumptions of the information provided.
Assumption #1 - the field "shame" in the Student Table should be "sname" which is Student Name?
Assumption #2 - The field "Cname" in the Faculty Table only stores the Professor's Last Name.
SELECT shame
FROM Student S
JOIN Enrolled E ON S.anum = E.anum
JOIN Faculty F ON E.cname = F.cname AND F.cname = "Ram"
WHERE S.level = "juniors"
Send me a message if you would like to discuss this response or if you would like assistance with your other two questions.