views:

49

answers:

3

i mostly need to know - views and their purpose ? - do they increase performance of an application ? - in what kind of cicumstance will I need to use views?

+3  A: 

As this is homework you should probably be doing research.

A quick Google yields plenty of links, one of which is http://www.techotopia.com/index.php/An_Introduction_to_MySQL_Views.

MySQL views are essentially a way to package up SELECT statements into re-usable virtual tables whereby the data can be retrieved simply by referencing the view, rather than having to repeat the associated SELECT statement.

The official site documentation is quite informative and readable too.

See: the MySQL FAQ page on Views and the Using Views documentation.

Graphain
+1  A: 

Views provide an abstraction layer over your tables.

They can be used to prevent access to certain sensitive columns (such as salary).

They are often used to encapsulate logic for reporting.

Mitch Wheat
A: 

in what kind of cicumstance will I need to use views?

If you're repeatedly using the same SELECT statement that uses lots of JOINs and/or function calls, a view makes it simpler to use.

dan04
when do i insert data into the views table? after inserting/updating maybe. or do i do it silently with a cron job maybe
soden
You don't need to insert anything into a view when you update its base tables; the data in the view is derived from what is in them.
Brian Hooper