Some database implementations, like Oracle, allow you to use a subselect in the FROM clause of a query. This SQL construct is also known as inline view, and it lets the subquery to be treated like a predefined view or table, even though an inline view is not predefined.
An inline view is basically a subquery, except it is always in the FROM clause of a SQL statement. The reason it is called aview is because it essentially functions as aview as far as the entire query is concerned.
But, remember that an inline view only exists in the query in which it is created – that is why they are calledinline views. So, inline views are not actually part of the database schema because they are not real views. Take a look at our very simple example of an inline view:
select max(age) from (-- this part of the query is an inline view:select age from table)
Of course, instead of using an inline view in the query above, you can simply write something like “select max(age) from table”, but this example was chosen for it’s simplicity in illustrating what an inline view would look like, certainly not for its real world applicability.
Is there a difference between inline views and derived tables? No, they both actually refer to exactly the same thing. You can also read about derived tables here:Derived tables.
Would you like to thankProgrammerInterview.com for being a helpful free resource?Then why not tell a friend about us, orsimply add a link to this page from your webpage using the HTML below.
Link to this page:
Please bookmark with social media, your votes are noticed and appreciated: