Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Display person's name who has got the MAX() salary of all employees along with his salary amount wit

2743467Sep 1 2014 — edited Sep 2 2014

The table is the already provided sample table in the 'hr' user of oracle.The table structure is:

Name                             Null Type   

--------------                        -------- ------------

EMPLOYEE_IDNOT NULL NUMBER(6)   
FIRST_NAME          VARCHAR2(20)
LAST_NAME  NOT NULL VARCHAR2(25)
EMAIL      NOT NULL VARCHAR2(25)
PHONE_NUMBER        VARCHAR2(20)
HIRE_DATE  NOT NULL DATE   
JOB_ID     NOT NULL VARCHAR2(10)
SALARY              NUMBER(8,2) 
COMMISSION_PCT      NUMBER(2,2) 
MANAGER_ID          NUMBER(6)   
DEPARTMENT_ID       NUMBER(4)   

So I wanted the result to display the 'FIRST_NAME' of the person with the maximum salary of all the employees and the salary of that person 'Max(Salary)'.

I got the answer with the following query:

select first_name,salary from employees

where salary in (select max(salary) from employees)  ;

But I wanted to know if there was another way to get the results without using subqueries? Thanks for your help.Appreciate it.

This post has been answered by Solomon Yakobson on Sep 1 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 30 2014
Added on Sep 1 2014
6 comments
2,758 views