user1535672
user1535672

Reputation: 193

Writing SQL into Relational Algebra

How can i write this SQL query into Relational algebra?

Select Distinct S.Name
From Student S, Transcript T1, Transcript T2
WHERE T1.StudId = S.Id AND T2.StudId = S.Id And
(T1.Semester =’S1997’ AND T2.Semester = ’F1998’)

Upvotes: 1

Views: 229

Answers (1)

roman
roman

Reputation: 117380

It's a little bit hard to say exact expression when I can't test it and I don't know your relation schema, but try smth like this

\project_{Name}
{
    {
        Student \join_{Id = StudId} \select_{Semester='S1997'} Transcript
    } \join_{Id = StudId}
    {
       \select_{Semester='F1998'} Transcript
    }
}

Upvotes: 1

Related Questions