Thursday, September 4, 2014

Can we Update Views?

Can we Update Views?

Oh yes, we can. There are a few golden rules to be followed to write an updateable view.

BTW, a view is a precompiled SQL statement.You can refer to my other blogpost to quickly recap on what is a view?

http://naveenieus.blogspot.in/2014/09/views-in-sql.html


To put it simple, the following are the NOT HAVE rules to be followed in the definition of a view;

1. Aggregate Functions
2. Distinct, Group By, Having
3. Sub Queries
4. Reference to a non-updateable view in the FROM clause
5. Sub Query
6. Temporary Tables
7. No duplicate view column Names
8. All columns in the base table not having Default Value should be included in the View Definition
9. Columns should be simple and not derived

Reference / Further Reading:

http://dev.mysql.com/doc/refman/5.0/en/view-updatability.html

Tags: Updateable View, View, Rules for Updateable View

No comments:

Post a Comment

Please leave your comments here...