Open In App

Week | 3 Complete Data Analytics | Question 1

Last Updated : 22 Nov, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Consider the following SQL query:

SELECT department, AVG(salary)
FROM employees
GROUP BY department
HAVING AVG(salary) > 50000;

What does this query do?
 

(A)

It calculates the average salary for each department and filters departments with an average salary greater than 50000.

(B)

It calculates the total salary for each department and filters departments with a total salary greater than 50000.

(C)

It calculates the average salary for all employees and filters employees with a salary greater than 50000.

(D)

It calculates the total salary for all employees and filters employees with a salary greater than 50000.


Answer: (A)

Explanation:

The query groups data by department, calculates the average salary for each group, and then filters the results to include only those with an average salary greater than 50000.


Quiz of this Question
Please comment below if you find anything wrong in the above post


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads