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 retrieve the top 3 salaries of the table using rownum

Answer Posted / d.elumalai

CREATE TABLE EMP (NAME VARCHAR2(20),SALARY NUMBER(10));

INSERT INTO EMP VALUES('AAA',10000);
INSERT INTO EMP VALUES('BBB',20000);
INSERT INTO EMP VALUES('CCC',30000);
INSERT INTO EMP VALUES('DDD',40000);
INSERT INTO EMP VALUES('EEE',50000);
INSERT INTO EMP VALUES('FFF',60000);
INSERT INTO EMP VALUES('GGG',70000);
INSERT INTO EMP VALUES('HHH',80000);
INSERT INTO EMP VALUES('III',90000);
COMMIT;

SELECT A.* FROM (SELECT name, salary FROM EMP ORDER BY salary DESC) A WHERE ROWNUM<=3;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?

1072


How is a process of pl/sql compiled?

1166


What is the use of procedures?

975


What are the types of keys?

998


How many types of index are there?

1045


What is a pdo connection?

1050


Which data dictionary views have the information on the triggers that are available in the database?

1244


what are the security recommendations while using mysql? : Sql dba

1124


Write a sql query to get the third highest salary of an employee from employee_table?

1077


what is the syntax for using sql_variant_property? : Transact sql

1049


is mysql query is case sensitive? : Sql dba

1107


Does sql view stored data?

963


Which software is used for pl sql programming?

993


Is sql a scripting language?

1022


How many columns should be in an index?

963