RSS Feed

SQL Inline Views

SQL Inline Views

It is a subquery that appears in the From clause of the Select statement. The inline view is a construct in Oracle SQL where you can place a query in the SQL FROM, clause, just as if the query was a table name. This subquery is enclosed in parenthesis and may be given an alias name. The columns selected in the subquery can be referenced in the parent query.

As an example let us suppose that we want to select first 3 employees hired by the company.

When considering using an inline view, ask the following questions:
* What value does the inline view add to the readability and, more importantly, the performance of the containing query?
* How large will the result set generated by the inline view be?
* How often, if ever, will I have need of this particular data set?
In general, using an inline view should enhance the readability and performance of the query, and it should generate a manageable data set that is of no value to other statements or sessions; Most common usage of an Inline View is in "TOP-N" analysis.

No comments:

Post a Comment