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

Laboratory Activity No 5 - Displaying Data From Multiple Tables

The document provides instructions for a midterm laboratory activity involving multiple SQL queries to retrieve employee and department information from various database tables. Students are asked to write SQL queries to: 1) Display all departments' information from the departments table. 2) Produce a report of all employee last names, department numbers, and department names. 3) Display employees in Toronto with their job, department number, and department name.

Uploaded by

qaaknleyble
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views3 pages

Laboratory Activity No 5 - Displaying Data From Multiple Tables

The document provides instructions for a midterm laboratory activity involving multiple SQL queries to retrieve employee and department information from various database tables. Students are asked to write SQL queries to: 1) Display all departments' information from the departments table. 2) Produce a report of all employee last names, department numbers, and department names. 3) Display employees in Toronto with their job, department number, and department name.

Uploaded by

qaaknleyble
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

College of Computer Studies

ITE 014 – Information Management

Midterm Period

Surname, Firstname Mi. Date:


Program / Section: Instructor:
Assessment Task: Laboratory Activity No 5: Displaying Data from Multiple Tables

Instructions:
- Connect to the SQL Plus, SQL Developer, or SQL Live using a database account. Example:
ORA2_PDBRAP
- Analyze and perform the problems below and answer it to the best of your ability
- Include screenshots of your complete SQL Statements and the result/s.
- Include a brief description/caption of each image
- There must be your full name for each image (see example below)
- Save your work as SURNAME_Lab5.DOCX (Ex. Pagaduan_Lab5.DOCX).
- Each item corresponds to one (1) point, total points is 11.

Sample: Answer:
Query:
Question:
Display all the departments' information.

Answer: Output:
Query:
SQL> SELECT * 2. The HR department needs a report of all
FROM departments; employees. Write a query to display the
last name, department number, and
Output: department name for all employees.
Answer:
Query:

Questions:

Test your knowledge Output:

1. Write a query for the HR department to 3. The HR department needs a report of


produce the addresses of all the employees in Toronto. Display the last
departments. Use the LOCATIONS and name, job, department number, and
COUNTRIES tables. Show the location department name for all employees who
ID, street address, city, state or province, work in Toronto.
and country in the output. Use a
NATURAL JOIN to produce the results. Answer:
Query: Query:

Output: Output:

4. Create a report to display employees’ 7. The HR department needs a report on


last name and employee number along job grades and salaries. To familiarize
with their manager’s last name and yourself with the JOB_GRADES table,
manager number. Label the columns first show the structure of the
Employee, Emp#, Manager, and Mgr#, JOB_GRADES table. Then create a
respectively. Place your SQL statement query that displays the name, job,
in a text file named department name, salary, and grade for
lab_05_04.sql all employees. (2 points)

Answer: Answer:
Query: Query:

Output: Output:

8. The HR department wants to determine


5. Modify lab_05_04.sql to display all the names of all employees who were
employees including King, who has no hired after Davies. Create a query to
manager. Order the results by the display the name and hire date of any
employee number. Place your SQL employee hired after employee Davies.
statement in a text file named
lab_05_05.sql. Run the query in Answer:
lab_05_05.sql. Query:

Answer:
Query:
Output:

9. The HR department needs to find the


Output: names and hire dates for all employees
who were hired before their managers,
6. Create a report for the HR department along with their managers’ names and
that displays employee last names, hire dates. Save the script to a file
department numbers, and all the named lab_05_09.sql.
employees who work in the same
department as a given employee. Give Answer:
each column an appropriate label. Save Query:
the script to a file named lab_05_06.sql.

Answer:
Output:

10. Create a report that shows the


organization chart for the entire
employee table. Write the report so that
each level will indent each employee 2
spaces. Use – (minus) symbol instead of
spaces in front of the column.

Answer:
Query:

Output:

Honor Pledge: "I affirm that we have not given or


received any unauthorized help on this
assignment and that this work is my own"

You might also like