Let’s suppose we have a simple posts table and a view, corresponding to the posts of the current week (let’s keep values hardcoded, for the sake of simplicity):
create table posts ( id integer not null auto_increment, title varchar(128) not null, content text not null, submit_time datetime not null, primary key (id), key (submit_time) );
create view posts_this_week as select * from posts where submit_time >= '2007-10-21 00:00:00' and submit_time < '2007-10-28 00:00:00';
So, say, you want to add an extra field to the posts table:
alter table posts add last_edit_time datetime not null;
You expect the field to be fetched by view as well, right? Wrong. In MySQL, the list of the fields to be fetched by a view is made up on view definition, rather than once the view used.
Often, such behaviour can lead to wrong assumptions (much due to classical explanation of views as query aliases), such as: server being out-of-sync when using replication, thus the table not containing the new field. So, when designing your application, keep in mind, that views, which should contain all fields from the table, have to be redifened every time table structure is altered.

















