find 2nd highest salary of person using cursor concept?
Answers were Sorted based on User's Feedback
Answer / amruta dash
select max(salary) from tbl where salary not in (select max
(salary) from tbl);
Is This Answer Correct ? | 11 Yes | 6 No |
Answer / jcreddy
select e1.salary from employee e1
where 1 = (select count(salary) from employee e2 where
e1.salary < e2.salary)
order by marks asc
-- by changeing from '<', to '>' you will get min salary
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / manju
DECLARE authors_salary CURSOR
select top2(salary) from tb_employee order by desc salary
open author_salary
FETCH NEXT FROM authors_salary into @topsalary
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / krish
select max(sal) frem tbl where sal <(select max(sal) from tbl;
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / pawan
select * from emp a where 2=(select count(distinct(sal)) from emp b where a.sal<=b.sal);
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / b.mamatha
select * from tabl1 where salary=(select max(salary) from
tabl1 where salary<(select max(salary) from tabl1)
Is This Answer Correct ? | 0 Yes | 1 No |
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
What is query processing?
State the difference between union and union all?
Explain Normalization and DE normalization
Can we call future method from trigger?
Tell me what are the advantages of using stored procedures?
what is performance tunning in sql server ? explain.
How to write stored procedure to update the data in 10 tables
Why I am getting "the microsoft .net framework 2.0 in not installed" message?
What is the difference between push and pull subscription? : sql server replication
How do you check sql server is up and running?
How do I run sql server 2014?