Write a query to find second highest salary of an employee.
Answers were Sorted based on User's Feedback
Answer / preetir
select min(sal) from (select distinct sal from emp order by
desc where rownum < 2)
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / arif saulat
select * from emp where sal <(select max(sal) from emp)
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / deepshikha
SELECT MAX (sal)
FROM emp a,
(SELECT MAX (sal) max_sal
FROM emp) abc
WHERE a.sal < abc.max_sal
ORDER BY sal DESC;
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / vamana murthy
select ename,salary from emp
where rownum=2
order by salary desc
| Is This Answer Correct ? | 0 Yes | 7 No |
Use the below Query:
Select Max(salary) from Emp
Where Max(salary) < (Select Max(salary) from emp
where emp-no=101);
| Is This Answer Correct ? | 10 Yes | 18 No |
Answer / kitcat
SELECT salary
FROM (SELECT salary FROM emp
ORDER BY DESC salary)
WHERE RowNum=2
| Is This Answer Correct ? | 1 Yes | 11 No |
What is the use of procedures?
What is the difference between rollback and rollback to statements?
how to enter binary numbers in sql statements? : Sql dba
What are the two types of exceptions.
Which one of the following is a reason that an INSERT statement might cause an error instead of executing correctly? 1. The INSERT statement was attempting to insert a record into a view that was created from more than one table. 2. The INSERT statement was attempting to insert a record using a combination of constants and values from an existing table. 3. The INSERT statement was attempting to insert a record with a non-NULL value into a table that has that column defined as NULL. 4. The INSERT statement was attempting to insert a record into a table by selecting a record from that same table. 5. The INSERT statement was attempting to insert a record into a view rather than a table.
What are pl/sql cursor exceptions?
what is the boundary line in varrays?
What is a crud api?
what are the different types of joins?
What is the limitation on the block size of pl/sql?
What does varchar include?
How do I clear the screen in sql plus?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)