0
To achive this task make your query as folloiwng way
select TableB.dept_name, SUM(TableA.emp_salary) from Employee as TableA
Inner join Department as TableB
on TableA.emp_dept_id = TableB.dept_id
Group by TableB.dept_name
0
create database cor
use cor
create table employee(emp_id int,emp_name varchar(50),emp_salary decimal(18,2),emp_dept_id int)
select * from employee
create table department(dept_id int,dept_name varchar(50))
SELECT employee.emp_dept_id, department.dept_name,sum(employee.emp_salary)as Salary
FROM department INNER JOIN employee ON department.dept_id = employee.emp_dept_id GROUP BY
employee.emp_dept_id,department.dept_name
0
Using Inner Join, join both tables based on column dept_id, list the columns.