0% found this document useful (0 votes)
7 views1 page

1) Select Sal, Deptno, Sal+ (Sal0.21)

The document contains a series of SQL queries designed to extract specific employee data from an 'EMP' table based on various conditions such as salary, hire date, job title, and department number. Each query filters results using different criteria, including calculations, string matching, and date ranges. The queries aim to provide insights into employee earnings, job roles, and hiring timelines.

Uploaded by

ajitmusale645
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

1) Select Sal, Deptno, Sal+ (Sal0.21)

The document contains a series of SQL queries designed to extract specific employee data from an 'EMP' table based on various conditions such as salary, hire date, job title, and department number. Each query filters results using different criteria, including calculations, string matching, and date ranges. The queries aim to provide insights into employee earnings, job roles, and hiring timelines.

Uploaded by

ajitmusale645
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1) select sal,deptno,sal+(sal*0.21) as deduction from emp where sal+(sal*0.

21) >
2000;

2) SELECT E.*, SAL*6 AS HALF_TERMSAL


FROM EMP E
WHERE SAL >= 1250 AND DEPTNO IN(10,30) AND HIREDATE > '3-DEC-1981';

3) SQL> SELECT ENAME FROM EMP WHERE ( HIREDATE > '31-DEC-1975' AND HIREDATE < '1-
JAN-1985' AND
2 HIREDATE NOT BETWEEN '1-JAN-1982' AND '31-DEC-1982' ) AND ( JOB IN( 'CLERK',
'ANALYST', 'PRE
IDENT' ) AND DEPTNO != 20 );

4) SQL> SELECT *
2 FROM EMP
3 WHERE ENAME LIKE '%A%'
4 AND ENAME NOT LIKE '%S%'
5 AND SAL <= 3000
6 AND MGR NOT IN(7566,7839);

5) SQL> SELECT ENAME FROM EMP


2 WHERE EXTRACT(YEAR FROM HIREDATE) IN(1981)
3 AND HIREDATE NOT LIKE '%FEB%' AND HIREDATE NOT LIKE '%MAY%'
4 AND SAL LIKE '____'
5 AND JOB LIKE '%AN%'
6 AND COMM IS NOT NULL;

8) SELECT ENAME, HIREDATE, DEPTNO


FROM EMP
WHERE ENAME LIKE '_I%N_'
AND EXTRACT(MONTH FROM HIREDATE) = 11
AND DEPTNO IN (10, 30)
AND HIREDATE NOT IN (TO_DATE('22-NOV-82', 'DD-MON-YY'), TO_DATE('17-NOV-87', 'DD-
MON-YY'))
AND MGR IS NULL;

6) SQL> SELECT 'HEY! ' || ENAME || ' YOU ARE EARNING RPS.' || SAL ||
2 ' WITH HIKE OF 35% KGF' AS MESSAGE
3 FROM EMP
4 WHERE SAL BETWEEN 1250 AND 1600
5 AND MGR IS NOT NULL;

7) SQL> SELECT * FROM EMP WHERE (JOB LIKE 'C%' OR JOB LIKE 'S%')
2 AND SAL >=1000
3 AND COMM IS NULL;

9) SQL> SELECT ENAME,JOB,COMM


2 FROM EMP
3 WHERE COMM IS NOT NULL
4 AND JOB LIKE '%LES%'
5 AND ( COMM LIKE '___' OR COMM LIKE '_' );

You might also like