Reputation: 964
Say I have the table :
CREATE TABLE `table` (
`IDTable` INTEGER PRIMARY KEY AUTO_INCREMENT,
`date` LONG
);
with view:
CREATE OR REPLACE VIEW `ViewTable` AS SELECT
`table`.`IDTable` ,
`table`.`date`
FROM
`table`;
If I eventually modify the column date from long to datetime, do I then need to rerun the create or replace view?
Upvotes: 0
Views: 38
Reputation: 71
No. You can leave your view alone. The types are effectively pass through for a view. The MySQL documentation found at MySQL View Documentation provides additional detail in regards to your inquiry. However, I will note that the documentation from MySQL states that a view is considered "frozen" when it is created (3rd paragraph). So you simply need to be aware that if you add a new column to any table you are referencing in the view, and you intend to use that column in the view, then you will need to replace it.
Upvotes: 1