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.
- An organization engaged 16 workers to complete a task in 24 days. After 9 days, 6 workers had to leave unexpectedly. How many additional days will it now t...
- 12 men working for 6 hours a day can complete a work in 20 days. If 30 women are employed to work, then find how many hours a day they have to work to comp...
4 men and 6 women together or 8 men can complete a piece of work in 20 days. 6 men and 6 women will complete the same work in
"A" and "B" together can complete a task in 16 days. Additionally, "B" alone is able to complete 40% of the task in 16 days. Based on this information, ...
P alone can finish a piece of work βMβ in 5 days while Q takes 3 days to finish it alone. P, Q and R working together can finish the work βNβ wh...
Vijay can do a piece of work in 16 days and Sanjay can do the same work in 24 days. If Vijay works for 6 days and got Rs. 2700, and the remaining work w...
A, B, and C are hired to complete a task. A and B together can finish the work in 12 days, B and C together in 15 days, and A and C together in 20 days....
15 men can complete a piece of work in 5 days, while 20 women can complete it in 5 days. 8 men start working on the job & after working for 3 days, ...
'Pawan' can complete a task alone in 63 days. However, when working together with 'Bhanu,' they finish the same task in 42 days. ...
(y+15) men can do a piece of work in (z-30) days. (y-15) men can do the same piece of work in (z+45) days. If (y+25) men can do the same work in (z-45) ...