can anybody tell us, how to select 2nd max salary from
table.
my id is ashish.akk@gmail.com
Answers were Sorted based on User's Feedback
Answer / arun ashok
Select max(salary) from employee where salary not in (select
max(salary) from employee)
| Is This Answer Correct ? | 1 Yes | 1 No |
Select top 1 salary from table where salary in(select top 2
salary from table order by salary desc)order by salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / pravin
select max(sal) from emp
where sal=(select max(sal)
from emp
where sal<(select max(sal)
from emp))
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / syaam
select a.sal from emp a
where 2=(select count(distinct b.sal) from emp b
where a.sal<= b.sal)
for getting nth max sal ..replace 2 by n
all the best
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / swapnl
select max(sal) from emp_det where sal not in (
select max(sal) from emp_det);
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / kumar
1 My Second Answer.
Select Top 1 * From Tablename where salary in
(select top 2 salary from tablename order by salary desc)
order by salary asc.
| Is This Answer Correct ? | 0 Yes | 4 No |
1.what are diff types of joins , and explain diff between cross join and full outer join 2.diff types of views 3. Diff types of index 4. What is diff b/w stores procedure and function procedure 5.diff between double and int in SQL 6.diff between char and varchar in SQL. 7.Oracle or SQL whice you will preferred and why.
What is difference between primary key and foreign key?
What will be the value of @@fetch_status if a row that was a part of the cursor resultset has been deleted from the database after the time the stored procedure that opened the cursor was executed?
How to Create Login and User through query in Sql server 2005.and also how to delete Login and User through query?
What is acid mean in sql server?
What factors you will consider calculating the storage requirement for that view?
What is a partition key?
What is bit datatype and what's the information that can be stored inside a bit column?
What is difference between view and materialized view?
Is it possible to replicate data from sql server to oracle? : sql server replication
What are the all different types of Joins in SQL Server 2000, Anybody can explain each join with definition..Thanks in advance....
9 Answers DELL, i Tech, Infosys, Siemens, TCS,
As a part of your job, what are the DBCC commands that you commonly use for database maintenance?
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)