Reputation: 631
I have found there is the 'comment' keyword in MySQL.(not comment syntax like /* */, #)
But I do not know the reason why there is the 'comment' keyword.
If there is the following table, how could I use the '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';
Upvotes: 12
Views: 4181
Reputation: 881153
Comments are a way to store relevant information in the database itself. For example, putting a comment on a column will cause it to be displayed by the show create table
and show full columns
commands.
Note that this is different to what most people think of as comments in SQL - those are simply statements in scripts that are ignored after being parsed. They do not make their way into any metadata for later retrieval.
Upvotes: 9