how to find the second highest salary from emp table?
Answers were Sorted based on User's Feedback
select top 1 salary from emp where salary in
(select top 2 salary from emp order by salary desc)
order by salary
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kiran
select max(sal) from emp where sal in(select sal from emp
where sal<>(select max(sal) from emp))
/
| Is This Answer Correct ? | 1 Yes | 0 No |
select max(emp-sal) from emp
where emp-sal <(select max(emp-sal) from emp).
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / anurag kumar rai
select max(sal) from employee where sal<(select max(sal) from employee)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sachin verma
select sal from emp
where rownum=2
order sal by Desc
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / anil maurya
select top 1 rate from HumanResources.EmployeePayHistory
where rate<(select MAX(rate) as R from HumanResources.EmployeePayHistory)
order by rAte Desc
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / surendra sharma
select min(sal) from table_name where sal in
(SELECT top 2 sal FROM table_name order by sal desc)
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / yash goyal
Select Distinct salary
from employees e
where &no-1=(select count(distinct salary )
from employees
where E.salary < salary);
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / bharat g
select * from (select ename,sal,dense_rank() over (order by sal desc) ranking from emp) where ranking=2;
| Is This Answer Correct ? | 1 Yes | 0 No |
if we give update table_name set column_name= default. what will happen? its given in pl sql block.what will hapen?
how will u find statistics of a database objects?
Which is better cte or subquery?
Why you are not able to create a table using select command,if it is having a LONG column? for eg:create table test as select * from test1 here test1 containg a column having LONG datatype...
Types of indexes. What is the default key created when a primary key is created in a table ?
What are packages in pl sql and also explain its advantages?
How can you load microsoft excel data into oracle? : aql loader
how do u call in & out parameters for stored procedures?
10 Answers A1 Technology, TCS, Techicon,
What is the difference between joins?
Differences between UNIQUE and DISTINCT in select statements
26 Answers ABS, DELL, Deloitte, Hewitt, Oracle, Verinon Technology Solutions, Wipro,
using comand prompt how can import table data and table space with example
What is sql performance tuning?
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)