how to get second highest salary in SQL(as/4000
Answer Posted / s. syam sundar
1.SELECT LEVEL,MAX(SAL) FROM EMP WHERE LEVEL = 2 CONNECT BY
PRIOR SAL >SAL GROUP BY LEVEL
2.SELECT SAL FROM (SELECT SAL FROM EMP ORDER BY SAL DESC)
WHERE ROWNUM <3
MINUS
SELECT SAL FROM (SELECT SAL FROM EMP ORDER BY SAL DESC)
WHERE ROWNUM = 1
3.SELECT MAX(SAL) FROM EMP WHERE SAL <> (SELECT MAX(SAL)
FROM EMP)
regards
syam sundaar
| Is This Answer Correct ? | 4 Yes | 5 No |
Post New Answer View All Answers
What is the limitation on the block size of pl/sql?
What sql database should I use?
How exception is different from error?
What is trigger types in sql?
Which sql statement is used to delete data from a database?
what are the 'mysql' command line arguments? : Sql dba
What is the difference between mdf and ndf files?
Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?
Can you have more than one trigger on a table?
i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this
What is trigger and types?
Why we use cross join?
What do you mean by field in sql?
What is sql query limit?
What is fmtonly in sql?