Anda di halaman 1dari 2

ITE

407 ADVANCED DATABASE MANAGEMENT SYSTEMS Laboratory Exercise 2.2

Theory: Multiple-Column Subqueries

This is a continuation of the laboratory exercise on Subqueries. A feature of asking for user
input will be explored.

Syntax

SELECT column, column, ...

FROM table

WHERE (column, column, ...) IN

(SELECT column, column, ...

FROM table

WHERE condition);

Note: For this lab exercise, you use the \HR schema.

Objective

The objective of this exercise is to demonstrate subqueries.

Tools/Applications

- Oracle Express covers a lot of group functions for this exercise. MySQL may also be used.
- A script that creates an HR Schema. This can be obtained from your Instructor. If you
use Oracle Express, it is part of the installation.

Lab Activity:

0. Open Oracle Express or MySQL.



1. Display the minimum salary in a department, by department, of all employees whose
average salary is equal to the maximum of the average salary in that department. [8]

2. Display all department details in the departments table whose department ID is not the
same as that in the employees table with job IDs SA_REP. Null department IDs must not
be allowed. [6]

3. What are the last names and salary details of all employees whose managers last name is
King? [4]

4. We use a correlated query to find all employees who earn more than the average salary in
their department. Show this querys results by salary. [6]

5. Display the department ID, last name, and job ID of all employees who are in the
department whose name is Executive. [5]









Thursday, March 5, 2017

Anda mungkin juga menyukai