Menu

Introduction to MYSQL View

What is MYSQL View

In simple language , Views are nothing but virtual tables and donot contain data in itself but display data stored in other tables. Views can be used for data abstraction i.e. to hide complexity of underlying table.

Advantages Of Views

- Exposing limited number of columns /data to particular set of users.
- Join two or more tables and show its outcome as single table to end user (i.e. hiding complexity of your data and tables).
- Enhancing security.

Limitations Of Views

- If view would join more then one tables DMl is not allowed.
- Any change in tablename or column name should get replicated in view defination as well otherwise it will give you error.
- Index cannot be created on view ,Indexes can be used for views processed using the merge algorithm. However, a view that is processed with the temptable algorithm is unable to take advantage of indexes on its underlying tables (although indexes can be used during generation of the temporary tables).
BASIC SYNTAX :-
		

create view view_name as 
select columnname1,columnname2 from table_name ; 


Joins can be used for creation of views
		
create view view_name  as 
select a.columnname1,b.columnname2 from table_name as a   
join table_name_2 as b  
on a.someuniqueid=b.someuniqueid ;
	

Video Tutorial - Create View

Support us by sharing our content :-

LinkedIn

Support us on Patreon :-
Become Patron