Tutorial Algebra
Tutorial Algebra
Relational Algebra
Dept. No. 5
Retrieve the SSN of all the employees who works in Dept No. 4
Retrieve the SSN of all employees who either works in Dept No.
QUERIES : EXAMPLE 2
Assume the following relational schemas:
employee (person_name, street, city) company (company_name, city) works (person_name, company_name, salary) manages (person_name, manager_name)
Project:
Find the names of all persons that have a job person_name(works)
Union:
Find the name of every person who is an employee or a manager person_name(employee) manager_name(manages)
There is automatic duplicate elimination in all algebra operations.
person_name(employee) manager_name(manages)
Exercise
Assume the following relational schemas:
employee (person_name, street, city) company (company_name, city) works (person_name, company_name, salary) manages (person_name, manager_name)
following queries:
Find the names of all employees who work for First Bank Corporation Find the names of employees who do not work for First Bank Corporation
Query 1
Find the names of all employees who work for First
Bank Corporation
person_name(company_name = First Bank Corporation(works))
Query 2
Find the names of employees who do not work for