Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the SQL Code based on the tables Name of employees in alphabetical order.

ID: 3700132 • Letter: W

Question

Write the SQL Code based on the tables

Name of employees in alphabetical order.

Name of employees, name of their corresponding departments and name of their corresponding branches.

The Department name and the sum of salary of all employees in the respective department.

Sum of Salary of All Employees

Sum of Salary by Department

Give a 10% raise to all Employees

Remove all employees located in Palo Alto

BRANCH bid B01 B02 bname Olympia Seattle EMPLOYEES Sala eid Ename E1 Bill Gates E2 Steve Jobs E3 Ted Codo E4 Michael Ci Redmond 90 Palo Alto 80 New York 70 Berkeley 60 didmi

Explanation / Answer

Name of employees in alphabetical order.

Select Ename from Employees order by Ename

Name of employees, name of their corresponding departments and name of their corresponding branches.

SELECT EMPLOYEES. Ename, DEPARTMENTS.Dname, BRANCH. Bname
FROM ((EMPLOYEES
INNER JOIN DEPARTMENTS ON EMPLOYEES.did = DEPARTMENTS.DID)
INNER JOIN BRANCH ON DEPARTMENTS.bid = BRANCH.bid);

The Department name and the sum of salary of all employees in the respective department.

SELECT DEPARTMENTS.Dname, SUM(EMPLOYEES.SALARY)

FROM DEPARTMENT, EMPLOYEES

JOIN EMPLOYEES ON DEPARTMENTS.Did=EMPLOYEES.Did

GROUP BY EMPLOYEES.Did

Sum of Salary of All Employees

SELECT SUM(Salary) from EMPLOYEES

Sum of Salary by Department

SELECT SUM(Salary) from EMPLOYEES GROUP BY DID

Give a 10% raise to all Employees

UPDATE EMPLOYEES SET Salary=Salary+Salary*.1

Remove all employees located in Palo Alto

DELETE * FROM EMPLOYEES WHERE CITY=”Palo Alto”