一个视图的列的MySql注释? [英] MySql comments for the columns of a view?

查看:449
本文介绍了一个视图的列的MySql注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySql中是否可以存储视图列的注释?

我知道如何在普通表和列中添加注释,但是我不确定是否可以为视图添加注释.我只知道视图(在某些方面)的行为就像表一样,因此,可以这样运行查询:

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.

推荐答案

根据create view语法,即使当前视图的列存在于视图的列"中,目前也无法将注释添加到该视图的列"中information_schema.columns表:

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

这篇关于一个视图的列的MySql注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆