Please help with the following SQL problems Relationships De

Please help with the following SQL problems:

Relationships Departments NEE Employees Relationships Projects V ProjedID ProjectName ProjectAssignments EmployeeID e 7 ProjectID Employees EmployeeID Firstname Lastname Department Job Class SupervisorID Annual la ue Leave TakensickLea Last ance Rating Gender Ag Departments Department

Solution

4.
WITH analytics AS
(
SELECT Firstname,Lastname,AnnualSalary
, ROW_NUMBER () OVER (ORDER BY AccuredSickLeave DESC) AS r_num
, COUNT (*) OVER () AS n_rows
FROM Employees   
)
SELECT Firstname,Lastname,AnnualSalary
FROM analytics
WHERE r_num <= ROUND (n_rows * 15/ 100)
ORDER BY AccuredSickLeave DESC


5.
SELECT *
FROM (select Firstname,Lastname,AnnualSalary from Employees ORDER BY LastPerformanceRating DESC) e
WHERE rownum <= 15
ORDER BY rownum DESC;

6.

select Firstname , Lastname, AnnualSalary/248 as \"DailySalary\"
from Employees;

7.

select max(AnnualSalary),min(AnnualSalary),avg(AnnualSalary),sum(AnnualSalary),count(*)
from Employees
where Department = \"engineering\";

8.
SELECT e.Firstname, e.Lastname, p.ProjectName
FROM Employees e,Project p,ProjectAssignment pa
where pa.ProjectID = p.ProjectID
and e.EmployeeID = pa.EmployeeID
and ProjectID != NULL;


9.
SELECT e.Firstname, e.Lastname, p.ProjectName
FROM Employees e,Project p,ProjectAssignment pa
where pa.ProjectID = p.ProjectID
and e.EmployeeID = pa.EmployeeID;

-- we do not add codition where projectId is null so it will print all records.

10.
SELECT EMP.Firstname, EMP.Lastname, PT.ProjectName
FROM Employees EMP,Project PT,ProjectAssignment pa
where pa.ProjectID = PT.ProjectID
and EMP.EmployeeID = pa.EmployeeID
and ProjectID != NULL;

Please help with the following SQL problems: Relationships Departments NEE Employees Relationships Projects V ProjedID ProjectName ProjectAssignments EmployeeID

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site