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.
How do you handle stress?
Are you more of an optimist or a pessimist?
How do you typically handle failures or setbacks?
How do you handle stress?
How important is it for you to have alone time?
How frequently do you feel satisfied with your present situation and the circumstances at hand?
How often do you find yourself worrying about the future or things you cannot control?
How often do you find yourself seeking out social interactions and group activities?
How do you feel about taking charge in a situation?
Do you like to be intellectual or innovative?