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
Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?
How is a process of pl/sql compiled?
What is the use of procedures?
What are the types of keys?
How many types of index are there?
What is a pdo connection?
Which data dictionary views have the information on the triggers that are available in the database?
what are the security recommendations while using mysql? : Sql dba
Write a sql query to get the third highest salary of an employee from employee_table?
what is the syntax for using sql_variant_property? : Transact sql
is mysql query is case sensitive? : Sql dba
Does sql view stored data?
Which software is used for pl sql programming?
Is sql a scripting language?
How many columns should be in an index?