Please help me I need this in an hour. Thank You Suppose the following tables ar
ID: 3722167 • Letter: P
Question
Please help me I need this in an hour. Thank You
Suppose the following tables are part of a project management database of a company, where keys are underlined: E(ssn, name, salary) stores the information of employees, P(pid, title, budget) stores the information of projects, and M(ssn, pid, start, end) stores the information of management of projects by employees.
Write a relational algebra expression to return the names of those employees who does not manage any project.
Write an SQL query to return the ssns of employees that managed no project in last 6 months.
Write an SQL query to return the name of employees that managed only 1 project which completed 2 years ago.
Write a SQl query to give everyone a 10% salary who managed 2 projects to completion in last year.
Explanation / Answer
relational algebra:
name( E - M)
select ssn from E where ssn not in (select ssn from M where end <= '2017-10-04');
select name from E where ssn in (select ssn from M where end >= '2016-03-04' group by ssn having count(1)=1);
Update E set salary = 1.1* salary where ssn in (select distinct ssn from M where end between '2017-01-01' and '2018-01-01' group by ssn having count(1)=2 );
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.