将SQL写入关系代数

时间:2012-10-15 07:20:17

标签: sql relational-algebra

如何将此SQL查询写入关系代数?

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’)

1 个答案:

答案 0 :(得分:1)

当我无法测试它并且我不知道你的关系模式时,说出确切的表达有点难,但是试试这样的smth

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