Continue with your mobile number
To calculate the average salary of employees in each department, we need to use the AVG() aggregate function in SQL. The GROUP BY clause is essential here, as it groups the results by department, ensuring the average is calculated for each individual department, not for the entire table. The correct SQL query is: SELECT department, AVG(salary) FROM employees GROUP BY department This query returns the department and the average salary of employees in that department. Why other options are wrong: b) SELECT department, SUM(salary) FROM employees GROUP BY department : This calculates the sum of the salary, not the average. It’s useful when you want the total salary for each department. c) SELECT department, AVG(salary) FROM employees : This query is incomplete because it lacks the GROUP BY clause. Without it, it would give the average salary for the entire table, not by department. d) SELECT AVG(salary) FROM employees GROUP BY department : This query incorrectly places the aggregate function without selecting the department column, which will result in an error or incorrect output. e) SELECT department, COUNT(salary) FROM employees GROUP BY department : This counts the number of salaries in each department, not the average salary.
Who is the author of the book “Fearless Governance” which was released recently?
As per the NSO Household Consumption Expenditure Survey (2023-24), which Indian state had the lowest share of food expenditure in 2023-24?
Which of the following is true about RAPIDX, the semi - high - speed rail service launched in the country?
I . It will connect Delhi to Agra
...According to the FICCI's Economic Outlook Survey (July 2022) India's economy is estimated to grow how much percentage in the current fiscal year?
Recently which of the following startup signed a pact with TATA Steel for drone-based mining solutions for effective mine management?
Guardian, a trade reporting and compliance management platform for organizations involved in the capital markets that has a primary role is to track and...
The Bumchu Festival is celebrated at which monastery?
NABARD does not provide refinance to -
What is the primary aim of the Avaana Sustainability Fund (ASF) project approved by GCF for SIDBI?
A cyclone erupted in the month of September,2021 in the Bay of Bengal ?