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 to find the second highest salary from emp table?

Answer Posted / kishan singh chilwal

SELECT MAX(sal)
FROM emp
WHERE sal <> (SELECT MAX(sal) FROM emp);

<> = not equal to
the SELECT statement in the WHERE clause will find the 1st max sal in the table
the 1st SELECT statement will find max sal in the table after excluding the first max sal

(ALTERNATE WAY)

SELECT MAX(sal)
FROM emp
WHERE sal not in (select max(sal) from emp );

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to use in conditions? : Sql dba

1010


Why functions are used in sql?

988


How to fetch values from testtable1 that are not in testtable2 without using not keyword?

1217


Does mysql support pl sql?

1166


Are views faster than queries?

987


what happens if you no create privilege in a database? : Sql dba

1001


What are all different types of collation sensitivity?

1029


Can you call pl/sql package functions from within a fast formula?

1036


what is recursive stored procedure? : Sql dba

984


How to pronounce postgresql?

1056


How many types of cursors are available in pl/sql?

1105


What is a schema sql?

1147


What is rownum in sql?

1043


What is information schema in sql?

1070


Does view store data in sql?

961