Question
Which SQL query would return the top three departments
with the highest total salaries from an employees table with columns department , salary , and employee_id ?Solution
Explanation: The correct query uses SQL’s GROUP BY to aggregate data by department , calculates the sum of salary for each department using SUM(salary) , and orders the results in descending order with ORDER BY . Finally, the LIMIT 3 clause retrieves only the top three departments. This approach is efficient and aligns with database query standards, ensuring the highest salaries are calculated accurately and in rank order. Option B: MAX(salary) cannot be used without a GROUP BY clause for the entire table, and the syntax is incorrect. Option C: COUNT(salary) measures frequency, not total salary. Option D: DISTINCT eliminates duplicates but does not aggregate data for rankings. Option E: MAX(salary) sorts by individual highest salaries, not aggregated totals, leading to incorrect results.
Which State has become first in India to have its own Internet Service K- Fon ?
What is the planned review year for the Kashi Declaration arising from the Youth Spiritual Summit?
What is the theme chosen by the Global Initiative for Asthma (GINA) for World Asthma Day 2024?
Rating agency Moody's has upgraded the long-term local and foreign currency deposit ratings of how many public sector banks from "Ba1" to "Baa3", reflec...
What is the total number of IFSC Banking Units (IBUs) operating in GIFT City as of the latest update (July 2025)?
What is the frequency of publishing the Consumer Price Index for Industrial Workers (CPI-IW) by the Labour Bureau?
In 2022, which aquatic species ranked eighth globally in yield according to the UN study "The State of World Fisheries and Aquaculture 2024"?
Which company has extended its partnership with Australia and New Zealand Banking Group Limited (ANZ) with a new digital transformation deal for the ban...
Who signed the schedule for the creation of the Russian orbital station?
In which city was the second Strategic Partnership Council meeting between India and Saudi Arabia held in April 2025?