Yurttas/PL/DBL/postgres/F/01/Company-A/q07.sql

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2REM
 3REM q07.sql
 4REM
 5REM For each department, retrieve the department name and the
 6REM average salary of employees working in that department.
 7REM
 8*/
 9
10SELECT current_schema();
11SET search_path to "companya";
12
13SELECT dname, AVG(salary)
14FROM Department, Employee
15WHERE dnumber = dno
16GROUP BY dname;