SQL Assignment 1
SQL Assignment 1
SQL Assignment 1
===========================================================================
14 rows selected.
2. Display unique Jobs from EMP table?
==
SQL> SELECT DISTINCT job, DEPTNO from emp;
JOB DEPTNO
--------- ----------
PRESIDENT 10
MANAGER 20
CLERK 10
SALESMAN 30
ANALYST 20
MANAGER 30
MANAGER 10
CLERK 30
CLERK 20
9 rows selected.
3. List the employees who joined before 1981.
==
SQL> SELECT * from emp WHERE HIREDATE < '01-JAN-1981';
9. List the grade, EMP name for the deptno 10 or deptno 30 but salary grade is not 4 while
they joined the company before ’31-dec-82’.
==
10. List the employees those who joined in company before 15th of the month.
==
13. Produce the output of EMP table ‘EMP_AND_JOB’ for Ename and Job.
==
8 rows selected.
23. List the employees who have joined on the following dates 1 may 81,17 Nov 81,30 Dec 81
==
24. List the employees who have joined in the year 1981.
==
25. List the employees whose annual salary ranging from 23000 to 40000.
==
SQL> SELECT ename, sal from emp WHERE (SAL + COMM)*12 BETWEEN 23000 AND
40000;
ENAME SAL
---------- ----------
MARTIN 1250
27. List the employees who joined in the second half of 82.
==
SQL> SELECT * from emp WHERE HIREDATE > '01-JULY-1982' AND HIREDATE < '31-
DEC-1982' ;
ENAME SAL
---------- ----------
SMITH 800
MILLER 1300
29. Find out the names and salaries of all employees earning more than 1000 per One month.
==
SQL> SELECT ename, sal from emp WHERE SAL + COMM > 1000;
ENAME SAL
---------- ----------
MARTIN 1250
ALLEN 1600
TURNER 1500
WARD 1250
30. Display the names and salaries of all employees except JAMES.
==
SQL> SELECT * FROM EMP where ENAME NOT IN ('JAMES');
14 rows selected.