Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Information Management Laboratory #2

NAME Lee, Jennefer ACTIVITY Number 2


Brazil
SECTION IT22S3 DATE February 15,
2022

Instructions
In this practice, you build more reports, including statements that use
the WHERE clause and the ORDER BY clause. You make the SQL statements more
reusable and generic by including ampersand substitution.

1. The HR department wants to run reports based on a manager. Create a query


that prompts the user for a manager ID and generates the employee ID, last
name, salary, and department for that manager’s employees. The HR department
wants the ability to sort the report on a selected column. You can test the
data with the following values:
a. manager ID = 103, sorted by employee last name
b. manager ID = 201, sorted by salary
c. manager ID = 124, sorted by employee ID

A. Manager ID = 103, sorted by employee last name


Select Statement from SQL Live:

Select employee_id, last_name, salary, department_id from


hr.employees where manager_id=103 order by last_name;

Screenshot of Output:
C. Manager ID = 201, sorted by salary
Select Statement from SQL Live:

Select employee_id, last_name, salary, department_id from


hr.employees where manager_id=201 order by salary;

Screenshot of Output:

C. manager ID = 124, sorted by employee ID


Select Statement from SQL Live:

Select employee_id, last_name, salary, department_id from


hr.employees where manager_id=124 order by employee_id;

Screenshot of Output:
2. . Display all employee last names in which the third letter of the name
is a.

Select last_name from hr.employee where last_name like ‘__a%’;

LAST_NAME

Grant

Whalen

3. Display the last names of all employees who have both an a and an e in
their last name.

LAST_NAME

Davies

De Haan

Hartstein

Whalen

4. Display the last name, job, and salary for all employees whose jobs are
either sales representative or stock clerk and whose salaries are not equal
to $2,500, $3,500, or $7,000.
5. Display the last name, salary, and commission for all employees whose
commission amount is 20%.
 
Honor Pledge for Graded Assignments:
I affirm that I have not given or received any unauthorized help on this
assignment, and that this work is my own.
-Lee, Jennefer Brazil

You might also like