有人可以帮我算出这两条 SQL 语句的关系代数吗。我无法理解它
SELECT EMP.*
, DEPT.DEPTNAME
, DEPT.BUILDING
, MANAGER.NAME DEPT_MANAGER
FROM DEPT DEPARTMENT
, EMPLOYEES EMP
, EMPLOYEES MANAGER
WHERE DEPT.DEPTMANAGERID = MANAGER.EMPID
AND EMP.DEPTNO = DEPT.DEPTNO;
和:
SELECT rep.repname SalesRep
, prod.productno ProdID
, prod.productname Name
, prod.productdesc ProdDesc
, prod.units Unit
, prod.productprice Price
, paint.*
, chem.*
, feed.*
, sup.repname Supervisor
FROM products prod
, salesreps rep
, salesreps sup
, paintproducts paint
, chemicalproducts chem
, animalfeedproducts feed
WHERE rep.salesrepid = prod.productsalesrepid
AND rep.supervisor = sup.salesrepid (+)
AND prod.productno = paint.productno (+)
AND prod.productno = chem.productno (+)
AND prod.productno = feed.productno (+);
我为第一个尝试了这个:
π emp.*, dept.deptname, dept.building, manager.name (Department |×| deptmanagerid = empid Employees) X (Employee |×| Emp.Deptno = Dept.DeptNo Department)
(抱歉不知道如何更改布局,所以它看起来可读)不知道那是否甚至远程正确,至于第二个我只是不知道从哪里开始