Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are given two tables, department and employee, with the following structure: create table department ( dept_id integer not null, dept_name varchar(3e) not null, dept_location
You are given two tables, department and employee, with the following structure: create table department ( dept_id integer not null, dept_name varchar(3e) not null, dept_location varchar(30) not nu11, ); unique(dept_id) create table employee ( emp_id integer not null, emp_name varchar(5e) 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 retums a table comprising all the departments (dept_id) in the table department that hire at least one employee, the number of people they employ and the sum of salaries in each department. The table should be ordered by dept_id (in increasing order). For example, for: department: \begin{tabular}{l|l|l} dept_id & dept_name & dept_location \\ \hline 10 & Accounts & Delhi \\ \hline 20 & Delingeting & Delhi \\ 40 & Markel & Warsaw \\ 30 & Production & Hyderabad \\ 50 & Sales & Bengaluru \end{tabular} employee: your query should return
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started