将SQL转换为关系代数

时间:2012-01-04 01:59:37

标签: relational-algebra

请任何人都可以帮助将以下两个SQL语句转换为Relational Algebra

1)

SELECT D.Dname 
FROM Employee E, Department D
WHERE E.Dno = D.Dno
  AND E.Lname='Smith'
  AND S.Fname='John'

2)

SELECT B.Town
FROM Staff S, Branch B
WHERE S.BranchId = B.BranchId
  AND S.lName='Pincher'
  AND S.fName='Penny'

3 个答案:

答案 0 :(得分:4)

answer ......我想你的意思是WHERE子句中的D.Fname ='John'

答案 1 :(得分:1)

这是第二个SQL语句的关系代数:

π Town (σ lName ='Pincher'^ fName ='Penny'(Staff | x | BranchId Branch))

答案 2 :(得分:0)

π Dname (σ Lname ='Smith'^ Fname ='John'(Employee | x | Dno Department))