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
Can we use insert statement in function?
how to concatenate two character strings? : Sql dba
give the syntax of grant and revoke commands? : Sql dba
Is sql harder than python?
What is sql*plus?
Can two tables have same primary key?
what are the join types in tsql? : Transact sql
explain what is mysql? : Sql dba
what is the stuff function and how does it differ from the replace function? : Sql dba
how to get help information from the server? : Sql dba
What will you get by the cursor attribute sql%rowcount?
What is varray in pl sql?
Write a unique difference between a function and a stored procedure.
what are null values? : Sql dba
how to convert character strings to dates? : Sql dba