Home » SQL » Selecting from the Results of Another Query

Selecting from the Results of Another Query

Selecting from the Results of Another Query

You need to treat the results of a query as if they were the contents of a table. You don't want to store the intermediate results as you need them freshly generated every time you run your query.
Oracle's inline view feature allows a query to be included in the FROM clause of a statement, with the
results referred to using a table alias.
select d.department_name
from
(select department_id, department_name
from hr.departments
where location_id != 1700) d;

The results will look like this.
DEPARTMENT_NAME

----------------

Marketing

Human Resources

Shipping

IT

Public Relations

Sales

6 rows selected.

1 thought on “Selecting from the Results of Another Query”

Comments are closed.