Question
Which of the following query will return the
third-highest salary from an Employee table in SQL?Solution
To get the third-highest salary, the query SELECT salary FROM Employee ORDER BY salary DESC LIMIT 1 OFFSET 2; fetches the salary value after skipping the top two highest salaries. The outer query ensures that we only get the third-highest salary. Why Other Options are Wrong: a) Incorrect usage of LIMIT; it should be OFFSET 2 instead of LIMIT 2, 1. b) This would return multiple rows or result in an error. c) DISTINCT is unnecessary and could result in wrong data if multiple employees have the same salary. e) This query would return the first three salaries in ascending order, not the third-highest.
Find the third proportional to 16 and 48?
The total number of students in a school is 20100. If the ratio of boys to the girls in the school is 63:71 respectively, then find the total number of ...
The total number of students in a school is 20020. If the ratio of boys to the girls in the school is 73:81 respectively, then find the total number of ...
In an office, the ratio of the number of males to number of females is 13:9. If 3 males joined the class and 7 females left the class, then the ratio of...
The ratio between two numbers is 3:4. If each number is increased by 8, the ratio between then become 5:6, find the difference between numbers.
Consider two positive numbers that have a ratio of 5:7. If the combined total of their squares equals 1184, determine the sum of these two numbers.
A bag contains 1 rupee, 50-paise, and 25-paise coins in the ratio 5 : 6 : 8. If the total amount is Rs. 240, find the number of 25-paise coins.
- If ‘A’, ‘B’ and ‘C’ are in proportion in the given order while ‘A’ = 18 and ‘B’ = 54, then find the value of ‘C’.
An integer 'p' is added to each of 7, 15, 27 and 45 so that the resulting numbers will be in proportion in given order only. Find the value of '(p + 4)'.
Three numbers ‘A’, ‘B’ and ‘C’ are such that ‘A’ is half of ‘B’ and ‘C’ is equal to average of ‘A’ and ‘B’. If sum of th...