The document contains 29 SQL queries to retrieve various information from an EMP database table. The queries find employee names and salaries, totals, averages, unique values, and filter records by conditions on salary, department, job, name, manager, and other fields.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0 ratings0% found this document useful (0 votes)
811 views2 pages
SQL Queries
The document contains 29 SQL queries to retrieve various information from an EMP database table. The queries find employee names and salaries, totals, averages, unique values, and filter records by conditions on salary, department, job, name, manager, and other fields.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 2
1. Retrieve a list of MANAGERS.
2. Find out salary of both MILLER and SMITH.
3. Find out the names and salaries of all employees ea rning more than 1000 per month. 4. Display the names and salaries of all employees exc ept JAMES. 5. Find out the details of employees whose names begin with S. 6. Find out the names of all employees that have A a nywhere in their name. 7. Find out the names of all employees that have L a s their third character in their name. 8. Find out the names of the employees whose name begi n with A or M. 9. Compute yearly salary of SMITH. 10. Compute daily salary of JONES. 11. Calculate the total monthly salary of all employees . 12. Print the average annual salary. 13. Select the name, job, salary, department number of all employees except SALESMAN from department number 30. 14. List unique departments of the EMP table. SQL> select distinct deptno from emp; DEPTNO --------- 10 20 30 15. List the name and salary of employees who can earn more than 1500 and are in department 10 or 30. Label the columns Employee and Monthly Salary respectively. SQL> SELECT ENAME "NAME",SAL "MONTHLY SALARY" FROM EMP WHERE SAL>1500 AND DEPTNO IN(10,30); 16. List the name and salary for all employees whose sa lary is not in the range of 1500 and 2850. SQL> SELECT ENAME, SAL FROM EMP WHERE SAL<1500 OR SAL>2850; 17. Display the name and job of all employees who do no t have a MANAGER. SQL> SELECT ENAME, JOB FROM EMP WHERE JOB IN ('MAN AGER','PRESIDENT'); 18. Display the name, job, and salary of all the employ ees whose job is MANAGER or ANALYST and their salary is not equal to 1000, 3000 , or 5000. SQL> SELECT ENAME,JOB,SAL FROM EMP WHERE JOB IN('M ANAGER','ANALYST') AND SAL <> 1000 AND SAL <> 2000 AND SAL <> 3000; 19. Display the name, salary and commission for all emp loyees whose commission amount is greater than their salary increased by 10 %. SQL> select sal,comm from emp where sal/10=comm; 20. Display the name of all employees who have two Ls in their name and are in department 30 or their manager is 7782. SQL> SELECT ENAME FROM EMP WHERE ENAME LIKE ('%L%L% ') AND DEPTNO = 30 OR MGR = 7782; 21. Display the names of employees with experience of o ver 10 years or und 0Count the total number of employees. 22. Retrieve the names of departments in ascending orde r and their employees in descending order. 23. Find out experience of MILLER. 24. How many different departments are there in the emp loyee table. 25. Find out which employee either work in SALES or RES EARCH department. 26. Print the name and average salary of each departmen t. 27. Select the minimum and maximum salary from employee table. 28. Select the minimum and maximum salaries from each d epartment in employee table. 29. Select the details of employees whose salary is bel ow 1000 and job is CLERK.