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
Does mysql_real_escape_string prevent sql injection?
What is partition by in sql?
What does pragma mean?
What is the difference between an inner and outer join?
How many sectors are in a partition?
Can we call a function containing dml statements in a select query?
What is the difference between clustered and non-clustered index in sql?
What is pl sql in oracle?
What is a Mapplet?
What is data types in sql?
hi,i plan to put experience on PLSQL ,can anyone suggest me for any institutes in bangalore or how to prepare for interviews
How do I write a cron which will run a sql query and mail the results to agroup?
How do I enable sql encryption?
What is cursor in pl sql with examples?
Is vs as in pl sql?