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

1562648046892_SQL_Assignment (2)

The document contains a table named EMP with employee details including employee number, name, job, manager, hire date, salary, commission, and department number. It also lists a series of SQL queries to retrieve specific information from the EMP table, such as displaying employee names and salaries, filtering by job titles, and sorting records based on various criteria. The queries aim to manipulate and extract data for analysis or reporting purposes.

Uploaded by

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

1562648046892_SQL_Assignment (2)

The document contains a table named EMP with employee details including employee number, name, job, manager, hire date, salary, commission, and department number. It also lists a series of SQL queries to retrieve specific information from the EMP table, such as displaying employee names and salaries, filtering by job titles, and sorting records based on various criteria. The queries aim to manipulate and extract data for analysis or reporting purposes.

Uploaded by

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

Assignment SQL

Table:EMP

EmpNo EName Job Mgr Hiredate Sal Com DeptNo


m
7839 KING PRESIDENT 17-NOV-81 5000 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7900 JAMES CLERK 7698 03-DEC-81 950 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7902 FORD ANALYST 7566 03-DEC-81 3000 NULL
7369 SMITH CLERK 7902 17-DEC-80 800 NULL
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7934 MILLER CLERK 7782 23-JAN-82 1300 NULL
Write the SQL queries for the following:
i) To display the employee number, his name and salary.

ii) To display all the records of the table.

iii) To display the different jobs without duplicate entries.

iv) To display system date from dual table.

v) To display the employee name, his salary and 50% of his salary.

vi) To display the ename and comm. Header ename and comm should be displayed as Employee Name
and Commission respectively.

vii) To display employee number, name, salary, salary increase by 15%. Label the column as New Salary.

viii) To display ename and comm. Substitute value 0.00001 for null in comm.

ix) To display the output in the following format <employee name> earns $ <salary> monthly and
working as <job>
x) To display ename joined with job with heading “employee”, sal * 12 as “total salary”.

xi) To display employee name and salary for employees having their salary more than or equal to 2900.

xii) To display all the records having job other than MANAGER.

xiii) To list all the employee details having department number 10 or 20

xiv) To list all the employee details having department number as 10 but with salary > 3000.

xv) To list all the employees whose department numbers are other than 30.

xvi) To list all the employees whose salary falls between 3000 to 4500

xvii) To list the names and salary of those employees who don’t have their salary in the range of 2500 to
4500

xviii) To display employee name, job and salary whose job is either MANAGER, SLAESMAN or
ANALYST.

xix) To display names of all those employees whose name contains ‘M’ as first alphabet, ‘L’ as third
alphabet.

xx) To display names of all employees whose have six letters employee name ending with ‘R’.

xxi) To list those employees whose salary doesn’t start with 2.


xxii) To list details of all employees whose department contain NULL.

xxiii) To display employee name, salary and department number who are not getting commission.

xxiv) To list the employees in the alphabetical order of their names in ascending order.

xxv) To display the list of employees having salary more than 2500 in the descending order of employee
number.

xxvi) To list the entire relation in descending order of salary and ascending order of employee name.

xxvii) To display name, job, salary and hiredate of employees whose sal is between 1000 and 2000. Order
the query in ascending order of hiredate.

xxviii) To display employee name and comm. Header of comm. should be displayed as commission. The
output should be arranged in ascending order of comm using alias commission.

xxix) To display ename, sal and sal added with comm..

xxx) List details of all clerks who have not been assigned departments as yet.

xxxi) To display details of those employees who have four lettered name.

xxxii) To display the details of employees who earn more commission than their salaries.

xxxiii) To display the name of the employee who is having ‘L as any alphabet of the name.

You might also like