0% found this document useful (0 votes)
3 views

SQL Assign-1

The document contains a series of SQL queries designed to retrieve specific information from an employee database. Queries include fetching annual salaries, employee names by job title, details of employees based on salary thresholds, and hire dates. The queries also filter results based on various conditions such as commission and department numbers.

Uploaded by

Sushant K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL Assign-1

The document contains a series of SQL queries designed to retrieve specific information from an employee database. Queries include fetching annual salaries, employee names by job title, details of employees based on salary thresholds, and hire dates. The queries also filter results based on various conditions such as commission and department numbers.

Uploaded by

Sushant K
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ASSIGNMENT -1

-- 1. Annual Salary of Employee Whose Name is SMITH

SELECT ENAME, (SAL * 12) AS ANNUAL_SALARY

FROM EMP

WHERE ENAME = 'SMITH';

-- 2. Name of Employees Working as Clerk

SELECT ENAME

FROM EMP

WHERE JOB = 'CLERK';

-- 3. Salary of Employees Working as Salesman

SELECT SAL

FROM EMP

WHERE JOB = 'SALESMAN';

-- 4. Details of Employees Who Earn More Than 2000

SELECT *

FROM EMP

WHERE SAL > 2000;

-- 5. Details of Employee Whose Name is JONES

SELECT *

FROM EMP
WHERE ENAME = 'JONES';

-- 6. Details of Employees Hired After '1-JAN-81'

SELECT *

FROM EMP

WHERE HIREDATE > TO_DATE('1981-01-01', 'YYYY-MM-DD');

-- 7. Different Salaries of Employees

SELECT DISTINCT SAL

FROM EMP;

-- 8. Name and Salary Along with Annual Salary If Annual Salary is More Than 12000

SELECT ENAME, SAL, (SAL * 12) AS ANNUAL_SALARY

FROM EMP

WHERE (SAL * 12) > 12000;

-- 9. EMPNO of Employees Working in Dept No 30

SELECT EMPNO

FROM EMP

WHERE DEPTNO = 30;

-- 10. ENAME and HIREDATE of Employees Hired Before 1981

SELECT ENAME, HIREDATE

FROM EMP
WHERE HIREDATE < TO_DATE('1981-01-01', 'YYYY-MM-DD');

-- 11. Details of Employees Working as Manager

SELECT *

FROM EMP

WHERE JOB = 'MANAGER';

-- 12. Name & Salary of Employees Earning a Commission of 1400

SELECT ENAME, SAL

FROM EMP

WHERE COMM = 1400;

-- 13. Details of Employees Having Commission More Than Salary

SELECT *

FROM EMP

WHERE COMM > SAL;

-- 14. EMPNO of Employees Hired Before the Year 1987

SELECT EMPNO

FROM EMP

WHERE HIREDATE < TO_DATE('1987-01-01', 'YYYY-MM-DD');

-- 15. Details of Employees Working as Analyst

SELECT *
FROM EMP

WHERE JOB = 'ANALYST';

-- 16. Details of Employees Earning More Than 2000 Per Month

SELECT *

FROM EMP

WHERE SAL > 2000;

You might also like