Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions

Question

5. Prepare for the role of interviewee

Answered: 1 week ago

Question

6. Secure job interviews and manage them with confidence

Answered: 1 week ago