Start learning 50% faster. Sign in now
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.
Which of the following is compulsorily registrable under the provision of the Registration Act 1908?
Where a company is formed and registered under this Act for a future project or to hold an asset or intellectual property and has no significant account...
Who is the ex- officio chairman of the Council of States?
The term resolution professional has been defined under the IBC as_______________
What are the prohibitions with respect to strikes and lock outs on a person employed in a public utility service, in breach of contract?
The Investors Education and Protection Fund is created by ___________________ and under _________________
As per the Companies Act till when shall the President and every other Member of the Tribunal shall hold office from the date on which he enters upon hi...
The definition of movable property under IPC excludes______________________
Whoever fails to comply with the order of State Comission can be penalised by State Comission, in such a case the State Commission shall have powers li...
The punishment to which offenders are liable under the provisions of the Indian Penal Code 1860 is: