SQL -Structured Query Language - SQL View - Create View Tutorial
SQL View is an imaginary view table based on information retrieved using a select query.
Suppose a user wants to create an imaginary result set that includes records from one or more tables. Then he can create a view using a select query included. And access just using a simple small query.
The syntax for view creation is-
CREATE VIEW view_name AS
[select query];
An example for view creation is-
CREATE VIEW usersalary_view AS
SELECT *
FROM employees as e
INNER JOIN
job_history as jh
WHERE e.employee_id = jh.employee_id;
Here it will create a view of a select query ( include inner join between employees and job_history table ).
With this, all long written queries (select query) will be seen using a simple view query.
Syntax to see the view-
SELECT * FROM view_name;
An example to see the view-
SELECT * FROM usersalary_view;