In this topic, we described about the Inline View with detailed example.
INLINE VIEW is the SELECT statement in another SELECT statement of FROM clause. INLINE VIEW is used to reduce complexity in queries without using JOIN.
SELECT column1,column2,… FROM (INLINE VIEW);
let us consider employee_ table as follows -
Scenario – Getting rows from table by using INLINE VIEW.
Requirement – Getting rows from employee_details by using INLINE VIEW. The query was as follows –
SELECT MAX(salary) AS max_salary FROM (SELECT salary FROM employee_details) AS max_salary;
By executing above query, we can get maximum salary from employee_details table by using INLINE VIEW statement. The query was as follows –
- There is no necessary to create a temporary table.
- We can get required rows by using a single query.