Question
Which of the following SQL queries is used to find the
second highest salary from an employee table? SELECT MAX (salary) FROM employee WHERE salary < ( SELECT MAX (salary) FROM employee);Solution
The query uses a nested SELECT statement to retrieve the second-highest salary from the employee table. Let's break it down:
- Inner query: SELECT MAX(salary) FROM employee retrieves the highest salary in the employee table.
- Outer query: The WHERE salary < (SELECT MAX(salary) FROM employee) ensures that only those salaries smaller than the highest salary are considered, and the outer MAX(salary) retrieves the largest salary from that set, effectively giving the second-highest salary.
- B is incorrect because the query does not return the highest salary but rather the second-highest salary by excluding the maximum salary.
- C is incorrect because nested SELECT statements are valid in SQL and do not cause errors here.
- D is incorrect because the query will return a value unless there are no records in the employee table.
- E is incorrect because the query will return a single value—the second-highest salary.
Which ministry published the 6th Census Report on Minor Irrigation (MI) Schemes?
What can be the possible steps to prevent inflation?
I. Change the monetary policy.
II. Controlling the money supply.
III. Higher I...
Which of the following is a component of the RAMP Scheme?
With reference to the New Education Policy (NEP), 2020, consider the following statements:
I.The Union government has ordered all states and UTs ...
The SVAMITVA Schemes comes under the administrative control of which Ministry?
The SIGHT Programme under the National Green Hydrogen Mission (NGHM) focuses on which sector?
Scheme of Fund for Regeneration of Traditional (SFURTI) comes under the administrtative control of ______.
What is approx. collection of Income tax during FY 2021-22?
One of the sub-schemes of SMILE is Central Sector Scheme for Comprehensive Rehabilitation for Welfare of Transgender Persons. Which of the following is ...
What technological tool is primarily used under the SVAMITVA scheme for mapping rural land parcels?