Database Reference
In-Depth Information
Example
Data request From PATIENT relation, find all the patients who have stayed
in the medical center for more than 15 days.
Relational algebra solution
SELECT (PATIENT : (DateDischarged - DateAdmit) > 15)
Note the syntax for the operation in relational algebra. The keyword SELECT
is used to indicate the operation.
Project
Features and function
Operates on a single relation.
Selects specific columns from a relation on the basis of given criteria.
The result is a relation containing rows and columns as indicated below:
Rows—same rows as in the original relation
Columns—only the selected columns from the original relation
Example
Data request From PATIENT relation, list only the names of patients and their
discharge dates.
Relational algebra solution
PATIENT [PatientName, DateDischarged]
Note the syntax for the operation in relational algebra. There is no need for a
keyword. The selected columns are indicated within the square brackets. In
this case, the result is a relation containing the same number of rows as the
number of patients in the database and two columns.
Assignment
Features and function
Simple operation; not really an operation in the sense of other operations.
Assigns the result of some set of operations to the resulting relation.
Example
Data request From PATIENT relation, find all the patients who have stayed in
the medical center for more than 15 days. Assign the result of the operation
to a relation called PATIENT-15.
Relational algebra solution
PATIENT-15:
=
SELECT (PATIENT : (DateDischarged - DateAdmit)
>
15)
Search WWH ::




Custom Search