Query for second maximum salary in each in each department
Answers were Sorted based on User's Feedback
Answer / jairam
select deptno,Max(e1.sal) from emp e1
where e1.sal NOT IN(select Max(e2.sal) from emp e2
group by e2.deptno)group by e1.deptno
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / nancy singhal
select max(salary) from emp where salary in(select salary
from emp where salary not in(select max(salary) from emp));
| Is This Answer Correct ? | 0 Yes | 3 No |
Answer / sravan
Select first_name, salary, rownum rank from
(select *from emp order by salary desc)
| Is This Answer Correct ? | 0 Yes | 5 No |
Answer / sampath pallerla
select distinct(a.sal) from emp a where 2=(select count(distinct(b.sal)) from emp b where a.sal<=b.sal);
| Is This Answer Correct ? | 1 Yes | 7 No |
Answer / yaswanth
select salary from(select salary,rownum rk from(select salary from employees order by salary desc)) ehere rk=2;
| Is This Answer Correct ? | 2 Yes | 13 No |
How to assign sql query results to pl sql variables?
difference between oracle 8i and oracle 9i
what is the need of the cursor attribute notfound..(because using found attribute we can complete the task......found + negation operator = not found )
What is crud diagram?
what is a tablespace? : Sql dba
in oracle 10g sw after compiling procedure how to pass parameter values ,if we (v_empid out number)how to give empid after successful compilation program.This site exact suitable for 10g with respect to question & answer same format , im trying sql browser & sql command prompt using exec procedure name & respective parameters.
What is transaction control language (tcl)?
What is the diffrence between IN and EXISTS.which one is faster.
How do you exit in sql?
table :- city name country code abc 11 bcd 22 cde 232 def 33 write a procedure , so that when we give a phone no. eg - 1123456789 - o/p sud be city name = abc if phone no. - 2322345897 , o/p sud be =cde note - bcd and cde city name sud be diff. as dey diff only with th last no. Pls ans. this questnion.
Is hadoop a nosql?
Dear All, Question for this Week Find out possible error(s) (either at compile time or at runtime) in the following PL/SQL block. State the reason(s) and correct the errors. Declare Cursor C1 is select ename, sal, comm from emp; Begin For i in C1 Loop If i.comm between 299 and 999 then Dbms_output.put_line(i.Ename || ‘ ** Good Commission’); Elsif i.comm > 999 then Dbms_output.put_line(i.Empno || ‘ ** Very Good Commission’); close C1; Else Dbms_output.put_line(i.Ename || ‘ ** ’ ||nvl(i.comm,‘O’)); End if; End Loop; End;
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)