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

Define implicit and explicit cursors.

1209


what happens if null values are involved in expressions? : Sql dba

1093


Enlist the characteristics of pl/sql?

1847


What is the difference between row level and statement level trigger?

1072


How do you declare a constant?

1018


What is oracle sql developer?

1119


How do you update f as m and m as f from the below table testtable?

1931


How do I delete a trigger?

1016


How do I edit a stored procedure?

1051


Is pl sql still used?

1018


what are set operators in sql? : Sql dba

1108


how to show all tables with 'mysql'? : Sql dba

1159


What are all the different normalization?

1087


What is sql and how does it work?

1252


What is cursor in pl sql?

1188