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

COMP 2605 Lab 2 Tutorial

This document outlines the tasks for an Oracle Lab focused on Enterprise Database Systems at the University of the West Indies. It includes a series of SQL queries to be executed on the myEmployee table, covering data display, filtering, and formatting. The tasks range from displaying table structures to calculating annual bonuses based on job titles.

Uploaded by

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

COMP 2605 Lab 2 Tutorial

This document outlines the tasks for an Oracle Lab focused on Enterprise Database Systems at the University of the West Indies. It includes a series of SQL queries to be executed on the myEmployee table, covering data display, filtering, and formatting. The tasks range from displaying table structures to calculating annual bonuses based on job titles.

Uploaded by

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

The University of the West Indies

St. Augustine
Department of Computing and Information Technology
COMP 2605– Enterprise Database Systems
ORACLE LAB # 2

1. Run the script lab2script.sql to create and populate your versions of the myEmployee
and myDepartment tables.

ALL THE FOLLOWING QUERIES WILL BE PERFORMED ON THE MYEMPLOYEE TABLE.

2. Display the myEmployee table structure.

3. (a) Display all the data from the myEmployee table by listing all the column names.

(b) Repeat the query using the * operator.

4. Display the employee name and hire date of all employees. Name consists of the first
and last name.

5. Display a list of all department numbers.

6. Display a list of distinct department numbers.

7. (a) Display the employee name, job title and annual salary of each employee.

(b) Display the same data in the previous table, this time labeling the columns as
“Name”, “Job title” and “Annual Salary” respectively.

8. (a) Display all data for sales employees.

(b) Repeat the query using the like operator.

9. (a) Display the employee name and title of all employees whose monthly salary lies in
the range $2,500 to $5,000.

(b) Repeat the query using the between operator.

10. Display the name and job title of all employees without a manager.

11. Display the names of all employees who report to managers 7698 and 7839.

Page 1 of 2
You are required to perform this query using two methods:
a) Using the in operator
b) Using logical and comparison operators.

12. Display the names of all salespersons that were hired on or before 1st March 1981.

13. Display the names of all salespersons in descending order by name.

14. Display the name, title and hire date of all employees in ascending order by title and
descending order by hire date within the title ordering.

15. Display each employee name with a count of the number of characters in the name. Use
length function.

16. Display the first letter of each employee’s name. Use substr function.

17. Display job data for all employees in the following format:

The job title of Employee SMITH is CLERK


The job title of Employee ALLEN is SALESMAN .
18. Display salary data for all employees in the following format: (Only first letter in name is
capital)

Joan Smith 800


Mike Allen 1600

19. Display the name, job title and manager of all employees. Your query should return the
value ‘No Manager’ for those employees without a manager.

20. Display the name, job title, annual salary and annual bonus for all employees, where
bonus is calculated as follows:

Clerk: annual salary * 0.02


Salesman: annual salary * 0.10
Manager: annual salary * 0.15
Analyst: annual salary * 0.05
President: annual salary * 0.20

Page 2 of 2

You might also like