Question: 2 . Consider the following relational schema. Emp ( eid: integer, ename: string, age: integer, salary: real ) Works ( eid: integer, did: integer, pct
Consider the following relational schema.
Empeid: integer, ename: string, age: integer, salary: real
Workseid: integer, did: integer, pcttime: integer
Deptdid: integer, dname: string, budget: real, managerid: integer
Write the following queries in relational algebra.
a Print the names and ages of each employee who works in both the Hardware department and the Software department. points
b Print the name of each employee whose salary exceeds the budget of all the departments that he or she works in To illustrate, if the employee works in departments, whose budgets are and respectively, then the maximum budget of all the departments that heshe works in is points
c Find the ename, age of managers who manage only departments with budgets greater than $ million. points
d Find the enames of managers who manage the departments with the greatest budgets. To illustrate, suppose there are three departments like this: department with a budget of $ million, department with a budget of $ million, department with a budget of $ million. Then departments and have the greatest budgets. points
Part II SQL Queries. points
Copy all SQL queries into one sql file called partsql For each query, please provide the comment as "parta for the first query.
All screenshots should be submitted together as a single pdf file called partpdf
Upload your submissions as a single archive file called partzip.
Consider the relational schema for company in Part I write SQL queries for each request in Part I. and one extra request in the following. Your queries should be executable in SQLite.
In this part, you also need to use the Adbplease download Adb from course files database in DB Browser for SQLite to give a screenshot for each query's result.
a points
b points
c points
d points
e For each department with more than fulltimeequivalent employees ie the total pcttime of the parttime and fulltime employees add up to at least hrs assuming that the pcttime of a fulltime employee is hrs print the did together with the number of employees that work in that department. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
