You are given two tables, department and employee, with the following structure
ID: 3860541 • Letter: Y
Question
You are given two tables, department and employee, with the following structure create table department ( dept id integer not null, dept name varchar (30) not null, dept location varchar (30) not null, unique (dept_id) create table employee ( emp id integer not null, emp-name varchar (50) not null, dept_id integer not null, salary integer not null, unique (emp_id) Each record in the table department represents a department which might hire some employees. Each record in the table employee represents an employee who works for one of the departments from the table department. The salary of each employee is known. (However, the locations of the departments are not relevant here.) Write an SQL query that returns a table comprising all the departments (dept id) in the table department that hire at lea 0/10+ Custom test casesExplanation / Answer
Select department.dept_id, count(employee.*) as count,sum(employee.salary) as sum_of_salary from employee inner join department on employee.dept_id = department.dept_id group by department.dept_id order by department.dept_id;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.