Objectives:
Assignment tools: None
Due date: Tuesday, July 25 by 11:00pm.
Turn in your solution using the assignment drop box linked from the main course
web page.
What to turn in:
One file, hw4-answers.{txt|rtf|pdf|doc|docx} (any one of those
formats)
with each question answered in (a) RC, (b) Datalog, and (c) RA
In this homework, we will work with the following relational schema:
Both the eid and mid values in Manager should hold the IDs of employees that exist. That is, both columns eid and mid in Manager are foreign key references to Employee(eid).
Also note that each employee can have multiple managers, and each manager can manage multiple employees. This is why Manager has no primary key.
For each query described below, show how to find the answer using relational calculus, and datalog. In other words, you should return three answers for each problem: (a) a relational calculus expression; (b) a query in datalog+negation (c) a relational algebra plan.
Assume that your datalog programs are using set semantics. However, for relational algebra, we will use bag semantics.
For (a) and (b), turn in your solutions by writing out the RC expression and datalog query, respectively. For (c), you can either draw out the RA plan as a tree as shown in lecture, or write them out as an expression (e.g., ĎSalary > 40000(Employee)). Recall that RA expressions are evaluated from left to right, and innermost expression first. Do not assume any precedence rules; write out all parentheses to denote precedence). In all cases, please make sure your logic and RA symbols are legible if you decide to draw them by hand and scan them in.
Optional: If you want to double check your answers, you can try executing them in DLV. (You will need to make up some facts about Employees and Managers.)
Extra Credit: