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 of the following statements about Subrahmanyam Jaishankar is/are correct?
(1) He was the then India’s ambassador to United State of Ameri...
Which of the following Part of the constitution is related to DPSPs?
SPMRM aim to develop _____ rural clusters identified
Which British scientist is known for developing the principle of holography in 1947 to improve the resolution of the electron microscope?
Viksit Bharat@2047 is
Due to the popularity of Indian clothes in Britain, a law was passed to ban Indian clothes. Which of the following was that law?
The powers and functions of Gram Sabha are conferred by the law of the state under which article?
Which state hosted the 36th National Games of India?
Which one of the following nation had recently joined the Europian Union(EU)?
Where is Amar Jyoti, which has been in discussion recently?