The table is the already provided sample table in the 'hr' user of oracle.The table structure is:
-------------- -------- ------------
| EMPLOYEE_ID | NOT 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.