Consider the following schema:


Transcript(StudId, CrsCode, Semester, Grade)
Teaching(ProfId, CrsCode, Semester)
Professor(Id, ProfName, Dept)


Write the following query in relational algebra and in SQL: Find all student Ids who have taken a course from each professor in the MUS Department .


1. Algebra:


?StudId,ProfId (Transcript  Teaching)/?ProfId (?Dept='MUS' (Professor))


2. SQL

SELECT R.StudId
FROM Transcript R
WHERE NOT EXISTS (
(SELECT P.ProfId
FROM Professor P
WHERE P.Dept = ’MUS’)
EXCEPT
(SELECT T.ProfId
FROM Teaching T
WHERE T.CrsCode = R.CrsCode
AND T.Semester = R.Semester)

Computer Science & Information Technology

You might also like to view...

Which of the following code segments writes the contents of three parallel arrays named strStudentName, intID, and strMajor to a file in the format below? Assume all arrays have the same number of elements.

Vince Student, 1234, Computer Science Nancy Student, 4321, Electrical Engineering a. ```For intCount = 0 to strStudentName.Length - 1 outputFile.Write(strStudentName(intCount) outputFile.Write(“, “) outputFile.Write(intID(intCount)) outputFile.Write(“, “) outputFile.WriteLine(strMajor(intCount)) Next intCount ``` b. ```For intCount =0 to strStudentName.Length - 1 outputFile.WriteLine(strStudentName(intCount) & “, “) outputFile.WriteLine(intID(intCount) & “, “) outputFile.WriteLine(strMajor(intCount)) Next intCount ``` c. ``` For intCount = 0 to strStudentName.Length - 1 outputFile.Write(strStudentName(intCount)) outputFile.Write(“, “) outputFile.Write(intID(intCount)) outputFile.Write(“, “) outputFile.Write(strMajor(intCount)) Next intCount ``` d. ```For intCount = 1 to strStudentName.Length outputFile.Write(strStudentName(intCount) outputFile.Write(“, “) outputFile.Write(intID(intCount)) outputFile.Write(“, “) outputFile.Write(strMajor(intCount)) Next intCount ```

Computer Science & Information Technology

Categorize each of the following items as either hardware or software:

a) CPU b) Compiler c) Input unit d) A word-processor program e) A C# program

Computer Science & Information Technology

Good design includes all of the following EXCEPT:

A) Make text readable B) Have a focal point C) Choose appropriate fonts D) Frequently use underlining, italics, bold, and all capital letters.

Computer Science & Information Technology

The standard protocol used for call setup in VoIP is the ________ Protocol.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology