0% found this document useful (0 votes)
197 views3 pages

Les 02

The document contains instructions for creating 15 SQL queries to generate reports for the HR department. The queries retrieve employee data like names, salaries, departments, and display the results in various formats sorted by different fields. The HR department needs the reports to analyze high and low salaries, find employees without managers, and allow flexible user prompts.

Uploaded by

Jessica Jca
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
197 views3 pages

Les 02

The document contains instructions for creating 15 SQL queries to generate reports for the HR department. The queries retrieve employee data like names, salaries, departments, and display the results in various formats sorted by different fields. The HR department needs the reports to analyze high and low salaries, find employees without managers, and allow flexible user prompts.

Uploaded by

Jessica Jca
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Because of budget issues, the HR department needs a report that displays the last name
and salary of employees who earn more than $12,000. Place your SQL statement in a
text file named lab_02_01.sql. Run your query.

2. Create a report that displays the last name and department number for employee
number 176.

3. The HR department needs to find high-salary and low-salary employees. Modify


lab_02_01.sql to display the last name and salary for any employee whose salary is not
in the range of $5,000 to $12,000. Place your SQL statement in a text file named
lab_02_03.sql.

4. Create a report to display the last name, job ID, and start date for the employees with
the last names of Matos and Taylor. Order the query in ascending order by start date.

5. Display the last name and department number of all employees in departments 20 or 50
in ascending alphabetical order by name.
6. Modify lab_02_03.sql to display the last name and salary of employees who earn
between $5,000 and $12,000 and are in department 20 or 50. Label the columns
Employee and Monthly Salary, respectively. Resave lab_02_03.sql as lab_02_06.sql.
Run the statement in lab_02_06.sql.

7. The HR department needs a report that displays the last name and hire date for all
employees who were hired in 1994.

8. Create a report to display the last name and job title of all employees who do not have a
manager.

9. Create a report to display the last name, salary, and commission of all employees who
earn commissions. Sort data in descending order of salary and commissions.

10. Members of the HR department want to have more flexibility with the queries that you
are writing. They would like a report that displays the last name and salary of
employees who earn more than an amount that the user specifies after a prompt. (You
can use the query that you created in practice exercise 1 and modify it.) Save this query
to a file named lab_02_10.sql. If you enter 12000 when prompted, the report displays
the following results:

11. 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:

manager ID = 103, sorted by employee last name:

manager ID = 201, sorted by salary:


manager ID = 124, sorted by employee ID:

12. Display all employee last names in which the third letter of the name is a.

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

14. 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.

15. Modify lab_02_06.sql to display the last name, salary, and commission for all
employees whose commission amount is 20%. Resave lab_02_06.sql as lab_02_15.sql.
Rerun the statement in lab_02_15.sql.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy