Interview Answer

Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. Alan Kay

List the highest salary paid for each job.

April 12, 2016 7:26 pm

Comments



List the highest salary paid for each job.



												desc HR.employees;
												
												Name           Null     Type         
												-------------- -------- ------------ 
												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)   
												

The Max funcation returns maximum value and group by funcation group the result set.


Solution

   					 
												SELECT JOB, MAX(SAL) FROM EMPLOYEE GROUP BY JOB;
																    

Comments



Please login to add comments.