Write SQL queries for this database Create the following queries on the COMPANY
ID: 3865764 • Letter: W
Question
Write SQL queries for this database
Create the following queries on the COMPANY database and show their results.
Here is my database https://www.mediafire.com/file/7g9p5hb1h3mkmm2/COMPANY_1.txt
5.For each project, retrieve the project name, controlling department name, number of employees, and total hours worked per week on the project.
6.Use nested query to: Retrieve the names of all employees who work in the department that has the employee with the highest salary among all employees.
7.Use nested query to: Retrieve the names of all employees whose supervisor’s supervisor has '888665555' for Ssn.
8.Use nested query to: Retrieve the names of employees who make at least $10,000 more than the employee who is paid the least in the company.
Explanation / Answer
5. Select p.pname,d.dname,count(e.dno),w.hours from project p
joins department d on p.dnum=d.dnum
joins employee e on p.num=e.dno
joins work w on w.pno=p.pnumber ;
6. Select e.fname,e.minit,e.lname from employee e where e.dno = (Select e.dno from employee e where e.salary=(Select max(e.salary) from employee e)) ;
7. Select Fname,Minit,Lname from Employee
where Super_ssn In
(Select SSN from Employee where Super_ssn='888665555');
8.Select e.Fname, e.Minit,e.Lname from Employee e where e.salary >=10000 + (Select Min(salary) from Employee));
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.