Create the following tables with given attributes having appropriate data type and specify the necessary
primary and foreign key constraints:
Employee (EmpId, Empname, Sal, Deptno)
Dept (Deptno, Dname, Loc,DeptmanagerId)
a) List the count of Employees and average salary of each department.
b) List the employee name, department name and the salary of all the employees.
Answers
Answered by
11
Dept (Deptno, Dname, Loc,DeptmanagerId)
a) List the count of Employees and average salary of each department.
Answered by
1
a) List the count of Employees and average salary of each department.
SELECT count(*)
avg(sal),
EmpId,EmpName
FROM Employee
Group BY DeptmanagerId,
Dname;
b)List the employee name, department name and the salary of all the employees.
SELECT s.salary, e.empname from employee JOIN salary on employee.empid=department.DeptmanagerId;
#SPJ2
Similar questions