Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation. Employee (empId, empName, empAge) Dependent(depId, eId, depName, depAge) Consider the following relational algebra query: ΠempId(employee)-ΠempId (employee⋈(empId = eID)∧(empAge ≤ depAge)dependent) The above query evaluates to the set of empIds of employees whose age is greater than that of

Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation. Employee (empId, empName, empAge) Dependent(depId, eId, depName, depAge) Consider the following relational algebra query: ΠempId(employee)-ΠempId (employee⋈(empId = eID)∧(empAge ≤ depAge)dependent) The above query evaluates to the set of empIds of employees whose age is greater than that of Correct Answer all of his/her dependents

Explanation:

Example:

Employee Relation:

EmpID

empName

empAge

e1

A

20

e2

B

25

e3

C

24

 

Dependent Relation:

depID

eID

depName

Age

d1

e1

X

30

d2

e1

Y

25

d3

e1

Z

20

d4

e2

P

18

d5

e2

P

17

d7

e3

Z

35

 

R1=ΠempId (employee⋈(empId = eID)∧(empAge ≤ depAge)dependent)

Output : e1,e3

R2=ΠempId(employee)

Output: e1,e2,e3

R = R2 - R1= {e1,e2,e3} - {e1,e3} = e2

  • e2 is output that is saying that set of empIds of employees whose age is greater than that of all of his/her dependents.

Related Questions

Consider the following relational schema: employee(empId,empName,empDept) customer(custId,custName,salesRepId,rating) salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return? SELECT empName FROM employee E WHERE NOT EXISTS (SELECT custId FROM customer C WHERE C.salesRepId = E.empId AND C.rating <> ’GOOD’);
The following relation records the age of 500 employees of a company, where empNo (Indicating the employee number) is the key: empAge(empNo, age) Consider the following relational algebra expression: πempNo(empAge ⋈ (age>age1) ρempNo 1, age1(empAge)) What does the above expression generate?
Consider the following three relations in a relational database. Employee(eId, Name), Brand(bId, bName), Own(eId, bId) Which of the following relational algebra expressions return the set of eIds who own all the brands? 
Consider the following relation schema Sailors(sid, sname, rating, age) Reserve(sid, bid, day) Boats(bid, bname, color) What is the equivalent of following relational algebra query in SQL query. πsname((σcolor= ‘red’Boats) ⨝ Reserves ⨝ Sailors)