A nested query is query within a query. More specifically, a nested query is a parenthesized query that can be used as a value in a number of places, such as instead of a relation or a selection condition. Specify the following queries on the database specified in Figure 3.5 using the concept of nested queries and the relational operators discussed in this chapter. Also show the result of each query as it would apply to the database state of Figure 3.6.

a. List the names of all employees who work in the department that has the employee with the highest salary among all employees.
b. List the names of all employees whose supervisor’s supervisor has '888665555' for SSN.
c. List the names of employees who make at least $10,000 more than the employee who is paid the least in the company.


a) RESULT <-- P LNAME ( S DNO = ( P DNO ( S SALARY = MAX(SALARY) EMPLOYEE ) ) EMPLOYEE )
b) RESULT <-- P LNAME ( S SUPERSSN = (P SSN ( S SUPERSSN = ‘88866555’ EMPLOYEE ) ) EMPLOYEE )
c) RESULT <-- P LNAME ( S SALARY >= 10000 + P SALARY ( S SALARY = MIN(SALARY) EMPLOYEE ) EMPLOYEE )

Computer Science & Information Technology

You might also like to view...

Which of the following specifies that schools must have written permission to release any information from a student’s education record?

A) FACTA B) FCRA C) FERPA D) DPPA

Computer Science & Information Technology

You should place your mouse ________ the keyboard

A) level with B) below C) on the left side of D) on the right side of

Computer Science & Information Technology

A paragraph can be selected by clicking anywhere in it three times

Indicate whether the statement is true or false

Computer Science & Information Technology

When you select the ________ paste option, only the formula will be pasted into the cell

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology