Two of the questions are below, if anyone can help with these two I'm sure that I can crack the rest!
Find the first name, surnames and address of the patients that have had at least one operation with broken bones.
SQL:
REL1=SELECT FROM Operation WHERE OperationType LIKE Broken%
REL2=Patient NATJOIN REL1 with PatientCode common.
REL3=PROJECT REL2 OVER PatientSurname, PatientFirstname, PatientAddress.
Relational Algebra:
σ operationtype = broken*(operation)
patient |x| operation
∏ patientsurname, patientfirstname, patientaddress (patient)
[I]Find the details of all patients that have shared any doctors with the patient that has the code P57". [/I]
SQL:
REL1=Operation NATJOIN Is_Seen_By with PatientCode common.
REL2=SELECT DoctorCode FROM REL1 WHERE PatientCode=P57.
REL3=Operation NATJOIN REL2 WHERE DoctorCode common.
REL4=Is_Seen_By NATJOIN REL3 WHERE DoctorCode common.
REL5=Patient NATJOIN REL4 with PatientCode common.
REL6=PROJECT REL5 OVER PatientCode, PatientSurname, PatientFirstname, PatientAddress, PatientSex, PatientAge, PatientOccupation, PatientHeight, PatientWeight.
Relational Algebra:
operation |x| is_seen_by
σ doctorcode ^ patientcode = p57(operation |x| is_seen_by)
(I can't get my head around this query at all, hence the lack of algebra)
Thanks.Bump. Please Help Me!|||Maybe these guys can help you.|||Thanks for the move, anyone got any help to offer? I'm really stuck on this one.
No comments:
Post a Comment