SQL VIEW

A view is a virtual table based on the result-set of an SQL statement .

A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.

We can add  fetch data from view using sql statements/function as if the data were coming from one single table.

Syntax

CREATE VIEW view_name AS SELECT * FROM table_name ;

Example

mysql> CREATE VIEW view_users AS SELECT * FROM users ;
Query OK, 0 rows affected (0.13 sec)


Share