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.
NITI Aayog released a report ‘India’s Booming Gig and Platform Economy’. According to it, the Indian gig workforce is expected to expand to _____ ...
By what percentage has India's gross direct tax collection increased as of October 2023?
Under the Setu Bandhan Scheme, how many bridge projects have been approved in Arunachal Pradesh for the fiscal year 2023-24, with a cumulative cost of ...
The central government has inked a pact with multi-lateral funding agency Asian Development Bank for USD 61 million (around Rs 454 crore) loan to fund d...
Recently which political party got The Status of “National Party”?
In which Indian state is the Pench Tiger Reserve (PTR) located, recently designated as India's first Dark Sky park?
The Reserve Bank of India (RBI) has imposed a monetary penalty of ______ on the Hongkong and Shanghai Banking Corporation (HSBC) for violating the Credi...
______ government has signed an MoU with Patanjali foods for the establishment of a palm oil cultivation project in the state.
___ government has launched a welfare fund for Mahatma Gandhi Rural Employment Guarantee Scheme (MGNREGS) workers in the State under which the wo...
Which bank has announced that it has signed a Master Inter Bank Credit Agreement with Export Import Bank of Korea for a USD 300 million line of credit t...