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.
In a village, number of male, female and children are in the ratio of 3:5:7. If 90% of the males are literate, 80% of females are literate and 40% of ch...
If two successive discounts of 20% and 12% are applied, what would be the equivalent single discount?
Out of the total income of Ravi, he spends 50% on food, 10% on rent and 20% on groceries. Out of the remaining income, he donates 30% in a charity and s...
A scored 20% more than B. If both score 4 marks more than the sum of the marks scored by A and B together would have been 20% more than the passing mar...
If the radius of the base of a right circular cylinder is increased by 20% and the height is decreased by 30%, then what is the percentage increase/decr...
Anil scored 40% marks and fell short of passing marks by 80, while Sunita scored 70% marks, which was 100 more than the passing marks. Find the total ma...
Fresh grapes contain 80% water while dry grapes contain 20% water. How many kilograms of fresh grapes are needed to make 500 grams of dry grapes?
The only expenses of Arun are on grocery, rent and fun expenses. Arun spent Rs. 5,250 on fun, amount spent by him on rent is Rs. 9,000 more than that on...
Monthly income of A is Rs. 3500 and he saves 42% of his monthly income. If monthly expenditure of A is decreased by 35% while his monthly savings is inc...
In a village with a population of 2500, 20% of the residents do not have a bank account. Among those who do have a bank account, 40% are females. How m...