Description: Here is the ERD, I have several relation schema, staff(eno, ename,
ID: 3593958 • Letter: D
Question
Description:
Here is the ERD,
I have several relation schema,
staff(eno, ename, title)
specialty(scode, sname)
patient(ssn, pname, dob, address, icode)
diagnosis(scode, dcode, charge)
visit(ssn, date, eno)
expertise(eno, scode)
appointment(ssn, date, time, duration, eno)
outcome(ssn, date, scode, dcode, ipay, ppay)
My question is, to use relational algebra, could you get
C Ch 2 1 1 * Y have O'" Ed) (ENN Few Stat - spe . Set to pusial Monto kay patie key Patius, Aimchedule date dates patient Icodo SN) in Noe LA D»Explanation / Answer
SELECT s1.eno,
s1.ename,
s1.title,
s2.eno,
s2.ename,
s2.title
FROM staff s1, staff s2
WHERE
(select sp.sname from s1, specialty sp , expertise exp
where sp.scode = exp.scode
and s1.eno = exp.eno
and exp.eno = s1.eno
and s1.title = 'Doctor' ) =
(select sp.sname from s2, specialty sp , expertise exp
where sp.scode = exp.scode
and s2.eno = exp.eno
and exp.eno = s2.eno
and s2.title = 'Nurse')
AND s1.eno <> s2.eno