Is it possible in MySql to store comments for the columns of a view?
I know how to add comments to normal tables and columns but I am not sure if it is possible to do so for views. All I know is that views (for some aspects) behave just like a table and for this reason it is possible to run a query as such:
SELECT
column_name, column_comment
FROM
information_schema.columns
WHERE
table_name='myview';
But I don't know how to add the comment in the first place and haven't found a solution yet!
The reason I am doing this is that I am storing metadata for my application in the comment field and I would like tables and views to be identical.
According to the create view syntax there is no way currently to add comments to the "columns" of a view even if the columns of a view are present in the information_schema.columns table:
http://dev.mysql.com/doc/refman/5.0/en/create-view.html
I don't think you can add comments to the view "columns", but you can use the view to retrieve comments from the underlying table, use SHOW COLUMNS as you would when querying a table.
Mysql has no metadata for view columns:
http://dev.mysql.com/doc/refman/5.0/en/views-table.html
So answer is NO.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With