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

The following schemas describe Presidents, Judges and the appointment relationsh

ID: 3623837 • Letter: T

Question

The following schemas describe Presidents, Judges and the
appointment relationships between them.


Presidents(PName : string, PDateOfBirth : int, Party : string, HomeState : string)
Judges(JName : string, JDateOfBirth : int, LawSchool : string)
Appoints(PName : string, JName : string, Date : integer)

Primary keys are underlined


Formulate the following queries on these schemas in relational algebra and SQL.

a) Retrieve the names of all the presidents.

b) Retrieve the names of all the judges graduated from Yale or Harvard.

c) Retrieve the names of the presidents who appointed judges from both Yale and

Harvard?

Explanation / Answer

a) select PName from Presidents b) select JName from Judges where LawSchool in('Yale','Harvard') c) select PName from Appoints where JName in(select JName as JudgeName from Judges where LawSchool in('Yale','Harvard'))