Chapter08 - Revised
Chapter08 - Revised
The Relational
Algebra
DNO = 4 (EMPLOYEE)
Select the employee tuples whose salary is greater than $30,000:
SALARY > 30,000 (EMPLOYEE)
operations
Necessary in some cases (see JOIN operation
later)
DEPT_MGR DEPARTMENT MGRSSN=SSN EMPLOYEE
MGRSSN=SSN is the join condition
Combines each department record with the employee who
manages the department
The join condition can also be specified as
DEPARTMENT.MGRSSN= EMPLOYEE.SSN
An example of a recursive operation is to retrieve
all SUPERVISEES of an EMPLOYEE e at all
levels — that is, all EMPLOYEE e’ directly
supervised by e; all employees e’’ directly
supervised by each employee e’; all employees
e’’’ directly supervised by each employee e’’;
and so on.
Copyright © 2017 Ramez Elmasri and Shamkant B. Navathe Slide 8- 55
Additional Relational Operations (continued)
Although it is possible to retrieve employees at each
level and then take their union, we cannot, in general,
specify a query such as “retrieve the supervisees of
‘James Borg’ at all levels” without utilizing a looping
mechanism.
The SQL3 standard includes syntax for recursive
closure.