Write SQL queries for this database Create the following queries on the COMPANY
ID: 3865825 • 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.
PLEASE MAKE SURE YOU SHOW THE RESULT FROM THAT REAL DATABASE.
Hopefully, aslo check the syntax.
Explanation / Answer
5)SELECT P.pname,D.dname,count(E.Fname),W.hours from EMPLOYEE E,DEPARTMENT D,PROJECT P,WORKS_on W where P.dnum=D.dnumber and E.dno=D.dnumber and P.pnumber=W.pno group by P.pnumber;
6)SELECT LNAME FROM EMPLOYEE WHERE DNO = ( SELECT DNO FROM EMPLOYEE WHERE SALARY = ( SELECT MAX(SALARY) FROM EMPLOYEE) );
7)SELECT LNAME FROM EMPLOYEE WHERE SUPERSSN IN( SELECT SSN FROM EMPLOYEE WHERE SUPERSSN = ‘888665555’ );
8)SELECT LNAME FROM EMPLOYEE WHERE 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.