Important Quries

Write a query to get the details of emp where empname can start with any character from A to S

SELECT * FROM EMP WHERE ENAME LIKE ‘[A-S]%’                                                                                                                                                                                                                                                                                                  

Write a query to get highest salary from each department

SELECT DEPTNO,MAX(SAL) FROM EMP GROUP BY DEPTNO


Write a query to get the highest salary from each job in each dept

SELECT DEPTNO,JOB,MAX(SAL) FROM EMP GROUP BY DEPTNO,JOB


Write a query to display no. of clerks  present in each department.

SELECT DEPTNO,COUNT(*) FROM EMP WHERE JOB=‘CLERK’

Write a query to get details of employees who is getting the highest salary in each department

SELECT * FROM EMP WHERE SAL IN(SELECT MAX(SAL) FROM EMP GROUP BY DEPTNO)

Write a query to get the details of employee who is getting the highest salary in deptno 10.

SELECT * FROM EMP WHERE SAL > (SELECT MAX(SAL) FROM EMP WHERE DEPTNO=10)

___________________________________________________________


No comments:

Post a Comment

We are here to listen you, Comment your valueable opinion...!!!