MySQL中'comment'关键字的目的是什么?

时间:2017-07-20 05:23:16

标签: mysql comments

我发现MySQL中有'comment'关键字。(不是注释语法,如/ * * /,#)

但我不知道有'comment'关键字的原因。

如果有下表,我怎么能使用'评论'?

create table Employee(
    id int not null auto_increment,
    create_dt date comment 'the date when employee was hired'
    salary int comment 'salary in EUR',
    primary key (id)
) comment 'The employee table of company AA';

1 个答案:

答案 0 :(得分:4)

注释是一种在数据库中存储相关信息的方法。例如,对列添加注释将导致show create tableshow full columns命令显示它。

请注意,这与不同大多数人认为是SQL中的注释 - 这些只是脚本中的语句,在解析后会被忽略。它们不会进入任何元数据以供以后检索。