

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Examples of relational calculus queries and their corresponding sql queries to extract specific information from an employee database. The queries cover various conditions such as salary range, department location, and employee-manager relationships.
Typology: Study notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Pure language Define a new relation whose features are defined over some variables. Variables are tuples in this format: { t | COND(t) } Any tuple that satisfy this condition will be a member of the result. {t | Employee(t) AND t.salary > 50K} Question: Find employees whose salaries are more than 50K. { t.Fname, t.SSN | Employee(t) AND t.salary > 50K} Question 1: Find the names and SSN of the employees whose salaries are more than 50K. {t.Fname, t.address | Employee(t) AND Э d, Department(d) AND d.Dname = 'Research' AND t.Dno = d.Dnumber} Question 2: Find the Fnames and address of all employees who work for the Research department. ○ SQL = a real-world t.r.c
Find the names of all employees who are younger than 45 and with salaries in the range [80000, 100000]. a. b. Find the 10s and the pct_time of the department John Doe works.
c. Find manager_id and the pct_time of the department John Doe works.
d. Find the names and age of all employees who work full time in one position(One department). e. Find the names of employees who works for a Brooklyn dept. and a Manhattan dept. Relational Algebra Examples: Existential mark
Tuesday, September 16, 2008 5:00 PM Database Systems Page 1
Note: When there is an AND in relational algebra we can use an intersection e. Find the names of employees who works for a Brooklyn dept. and a Manhattan dept.
f. Find the average salaries of employees with the same age, print out both age and average salary.
r s r = s x y g. Find the names of all employees who work for all depts. Located in Brooklyn. X = {enames} Y = {did} Hint: Manager is also a person who shows up in the Employee table. h. Find the names of all employees who earn more than his/her manager. For natural joins just draw the symbol with no condition y x Database Systems Page 2