Start learning 50% faster. Sign in now
This query uses a subquery to find the maximum salary and excludes it using NOT IN. The outer query then finds the maximum salary among the remaining values, effectively identifying the second highest salary. • Why this works: The subquery isolates the highest salary. The outer query ensures the second highest value is identified without requiring an OFFSET. This method works across most SQL systems and avoids platform-specific syntax like LIMIT or TOP. ________________________________________ Why Other Options Are Incorrect: 1. LIMIT 2: Returns two highest salaries but doesn’t isolate the second highest. 2. OFFSET 1: Many SQL platforms do not support LIMIT ... OFFSET or require modifications for accurate execution. 3. DISTINCT Salary: Redundant use of DISTINCT, which is unnecessary when ORDER BY already ensures unique ordering. 4. TOP 2: TOP is SQL Server-specific and requires additional filtering for the second value.
Pipe ‘A’ can fill a tank in 20 hours while pipe ‘B’ takes 25 hours to empty it. Pipe ‘A’ is opened alone when the tank was empty and after 1...
Pipe ‘A’ and pipe ‘B’, together can fill 20% of a tank in 8 hours while pipe ‘C’ takes 50 hours to empty it. ...
The work done by a man, a woman and a child are in the ratio of 4 :3: 1. There are 15 men, 20 women and 30 children in a factory. Their weekly wages amo...
If a tank can be filled by a tap in 16 hours, but due to an outlet, it actually takes 4 hours longer to fill the tank, find the duration in which the ou...
Pipe ‘A’ can fill a tank in 30 hours whereas leak ‘A’ can empty it in 40 hours. If they both operate along with pipe ‘B’, then the given tan...
A tank has two inlet pipes, A and B, and one outlet pipe, C. Pipe A can fill the tank in 6 hours, and pipe B can fill the tank in 8 hours. Pipe C can em...
A tank is filled by two pipes A and B in 12 minutes and 15 minutes, respectively. Another pipe C can empty the tank in 10 minutes. If all three pipes ar...
A bath can be filled by the cold water pipe in 20 hrs and by the hot water in 30 hrs. Mohit leaves the bathroom after turning on both pipes simultaneous...
An inlet pipe can fill a tank in 10 hours, whereas an outlet pipe can empty the same tank in 25 hours. Find the time taken by two such inlet pipes and o...
Pipes X and Y can independently fill a tank in 80 minutes and 90 minutes respectively, while pipes X and Z together take 3 hours to fill the same tank. ...