Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Database Assignment 1

Note : Use Emp, dept and salgrade table

1. To list all records with sal > 2000 and comm>200


2. To list all record with job=’Clerk’ or sal>2000
3. To list all the record with sal=1250 or 1100 or 2850
4. To list all employees with sal>1250 and <2850
5. To list all employees with name ends with AS
6. To list all employees with job starts with C and ends with K
7. To list all employees with job contains L at third position and
M at third last position
8. To list all the record with sal not equal to 1250 or 1100 or 2850
9. To list all employees with salnot >1250 and <2850
10. To list all employees with job starts with C , E at 3rd position and ends with K
11. To list all rows with comm is null
12. To list all employees with sal is null and name starts with ‘S’
13. To list all employees with job contains 5 characters
14. To list all employees with name contain ‘A’ at 1 position and job
Contains 5 characters

Q2. Solve the following

1. Retrieve the details (Name, Salary and dept no) of the emp who are working in
department code 20, 30 and 40.

2. Display the total salary of all employees . Total salary will be calculated as
sal+comm+sal*0.10

3. List the Name and job of the emp who have joined before 1 jan 1986 and whose
salary range is between 1200and 2500. Display the columns with user defined Column
headers.

4. List the empno, name, and department number of the emp works under manager
with id 7698

5. List the name, job, and salary of the emp who are working in departments 10 and
30.

6. Display name concatenated with dept code separated by comma and space. Name
the column as ‘Emp info’.

7. Display the emp details who do not have manager.


8. Write a query which will display name, department no and date of joining of all
employee who were joined January 1, 1981 and March 31, 1983. Sort it based on date of
joining (ascending).

9. Display the employee details where the job contains word ‘AGE’ anywhere in the Job

11. List the details of the employee , whose names start with ‘A’ and end with ‘S’ or
whose names contains N as the second or third character, and ending with either ‘N’ or ‘S’.

12. List the names of the emp having ‘_’ character in their name.

Single Row functions

1. To list all employees and their email, to generate email use 2 to 5 characters from ename
Concat it with 2 to 4 characters in job and then concat it with ‘@mycompany.com’
2. List all employees who joined in September.
3. List the empno, name, and department number of the emp who have experience of 18 or
more years and sort them based on their experience.
4. Display the employee details who joined on 3rd of any month or any year
5. display all employees who joined between years 1981 to 1983.

Group functions

6. Display the Highest, Lowest, Total & Average salary of all employee. Label the columns
Maximum, Minimum, Total and Average respectively for each Department. Also round the
result to the nearest whole number.
7. Display Department no and number of managers working in that department. Label the
column as ‘Total Number of Managers’ for each department.
8. Get the Department number, and sum of Salary of all non managers where the sum is
greater than 20000.

You might also like