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.
- The product of two numbers is 4620 and their L.C.M is 210. What is the H.C.F of the two numbers?
The HCF of two numbers is 9. Which of the following can never be their LCM?
What is the Highest Common Factor of 75, 150 and 225?
If 12 times a number is subtracted from the square of the number and then 36 is added to the result, then the result is zero. Find the L.C.M of the num...
- The product of two numbers is 2160 and their L.C.M is 180. What is the H.C.F of the two numbers?
Determine the difference between the LCM and HCF of 18, 24, and 36.
Find the HCF of 864, 1080 and 1512.
If 16 times a number is subtracted from the square of the number and then 64 is added to the result, then the result is zero. Find the L.C.M of the num...
LCM of two numbers is 18 times their HCF. The product of the numbers is 64800. What will be the maximum possible difference between the numbers?
The smallest number which when divided by 23 and 28 leaves remainder 11 and 16 respectively is: