SQL Assignment 6
SQL Assignment 6
1. Create a report that displays the employee number, last name, and salary of all
employees who earn more than the average salary. Sort the results in ascending order
by salary.
2. What is Sub-query and the sub-query can be placed in which SQL clauses?
The order of execution is first the inner query placed inside the parenthesis and then
the outer query. It is nothing but the nested query. The result of inner query is placed
The sub-query can be placed in three clauses. Those are HAVING,WHERE and
FROM clause.
3. Write a query that displays the employee number and last name of all employees
who work in a department with any employee whose last name contains a “u”.
%’)).;
Single row queries return only one row where as multi-row returns more than one row.
5. The HR department needs a report that displays the last name, department number,
location_id=1700);
6. Create a report for the HR department that displays the last name and salary of every
7. The outer query and inner query can get data from different tables (TRUE/FALSE).
True.
comparison operators.
Single-row operators are >,<,<=,>=,<>,= and multi-row operators are IN,ANY and
ALL.
Ex-Display the employees whose job ID is the same as that of employee 100;
Select job_id from employees where job_id=(select job_id from employees where
Select last_name from employees where salary in(select salary from employees
True
10. Create a report for the HR department that displays the department number, last
13. Write a Query to display the employee number, last name, and salary of all the
employees who earn more than the average salary and who work in a department