0

I'm just hoping for guidelines, NOT answers.

How is a left outer join written in Relational Calculus?

Here is the statement I wrote in algebraic notation:

Doctor (⟕) Doctor.Doc_id = Duty.Doc_id Duty

(a left outer join symbol)

And here's the calculus notation I wrote:

{S|∃ D ∈ Doctor (∃ C ∈ Duty (D.Doc_id = C.Doc_id ^
 S.Doc_id = D.Doc_id ^
 S.Doc_fName = D.Doc_fName ^
 S.Doc_lName = D.Doc_lName ^
 S.Position = D.Position ^
 S.Qualification = D. Qualification ^
 S.YearsExperience = D.YearsExperience ^
 S.Dept_id = D.Dept_id ^
 S.Duty_id = D.Duty_id ^
 S.Staff_id = D.Staff_id ^
 S.Date = D.Date ^
 S.Duty_type = D.Duty_type ^
 S.Max_no = D.Max_no ^
 S.Given_no = D.Given_no ^
 S.Avaliable_no = D.Avaliable_no ^
 S.Current_no = D.Current_no ^
 S.Room_no = D.Room_no)}

I understand that outer join means everything in the relation will be displayed. But I don't know how else to write it where it will be displayed.

Was my calculus notation right? If not, what did I do wrong?

philipxy
  • 14,867
  • 6
  • 39
  • 83
Tsar
  • 170
  • 1
  • 6
  • 20
  • First of all, I can not see that you are not closing all your '('. I also agreed to IMSoP that this is not SQL. That said, In your left outer join, you are checking on the DocID, but in your calculus notation, your are checking on a lot more fields. I am not that familiar with that notation, but any way, I can not see that this can be the same. – Teis Lindemark May 03 '14 at 19:10
  • 1
    This technically belongs on http://math.stackexchange.com/, which also has full support for displaying mathematical symbols. – wvdz May 03 '14 at 20:25

1 Answers1

1

This is the translation to SQL for your formula that starts with

{S|∃ D ∈ Doctor (∃ C ∈ Duty (D.Doc_id = C.Doc_id ^ (etc..) ) ) }

SELECT * FROM S
    WHERE EXISTS (SELECT * FROM Doctor D
        WHERE EXISTS (SELECT * FROM Duty C
             WHERE (D.Doc_id = C.Doc_id)
             AND (etc...)));

So I guess the answer is no, this is not a left outer join.

wvdz
  • 16,251
  • 4
  • 53
  • 90