Answer Posted / kanhu charan biswal
select ename, sal from emp where sal=(select max(sal) from
emp);
For see the max(sal) with ename departmentwise the query
will be:
select ename,sal from emp a
where sal in (select max(sal) from emp group by deptno);
For findout the nth highest salary with name, the query
will be:
select ename,sal from emp a
where &n=(select count(distinct sal) from emp b
where b.sal>=a.sal)
after execute the query it will ask you to pass a value
for 'n'.it stands for nth hiest salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between alter trigger and drop trigger statements?
What is database white box testing and black box testing?
What are the set operators in sql?
What are character functions in sql?
Can dml statements be used in pl/sql?
How can check sql version from command line?
What is inner join in sql?
Why do we create views in sql?
Explain what is rdbms?
Why functions are used in sql?
What is the example of procedure?
explain the difference between bool, tinyint and bit. : Sql dba
Can a commit statement be executed as part of a trigger?
How do I run a sql trace?
How do you select unique values in sql?