Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

HOW CAN I FIND MAX SAL ,ENAME FROM EMP TABLE.

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


Please Help Members By Posting Answers For Below Questions

What is the difference between alter trigger and drop trigger statements?

1044


What is database white box testing and black box testing?

1048


What are the set operators in sql?

1032


What are character functions in sql?

893


Can dml statements be used in pl/sql?

1021


How can check sql version from command line?

1014


What is inner join in sql?

1004


Why do we create views in sql?

1055


Explain what is rdbms?

993


Why functions are used in sql?

931


What is the example of procedure?

878


explain the difference between bool, tinyint and bit. : Sql dba

939


Can a commit statement be executed as part of a trigger?

998


How do I run a sql trace?

908


How do you select unique values in sql?

938