Employee(id, name, salary)The interpretations should be obvious. Employees have ID's (key), name and salary. Manages has a listing of the immediate manager for each employee (emp_id is the key). Department has a listing of id (key) and the corresponding deptNo. Each employee has one direct manager. In addition, all the mangers of an employee's manager also serve as a manger for that employee. Write the following queries in Datalog. You should use only safe rules, but you may wish to use several IDB predicates corresponding to subexpressions of complicated expressions.
Manages(emp_id, mgr_id)
Department(id, deptNo)
Bids(auctionID, bidder, price, quantity)
Auctions(auctionID, seller, item, quantity, expires)
Ratings(seller, stars)
where you may assume that in Bids, a bidder may place several bids for one auction, but all bids by one bidder will have different prices.
Write the following queries in Datalog. You may wish to define several "helper" IDB predicates.