Inline views:-
Oracle
allows us to use subset in FROM clause of a select query which is known as INLINE VIEW. It treats the inline view
as predefine view even though it’s not predefined. It is called inline view
because it functions like a view in a sub query.
Let’s have an example of inline view:-
Create employee table and insert some values in that:-
Inline view query:-
If you want
to fetch the count of records from one table and all the related records from
other table then you can achieve this by below query:-
Sub query in oracle:-
In oracle, we can define query in WHERE clause of the select statement. It is called sub query because it is a query in another query.
The difference between inline view and sub query is, inline view is used in FROM clause and sub query is used in WHERE clause.