The comments can be added to the MySQL columns while creating a table by adding the COMMENT keyword after the column definition, as shown above for column emp_name. The table is created successfully with comments. Confirm the same in column information using MySQL workbench.
Multi-line comments start with /* and end with */ . Any text between /* and */ will be ignored.
i.e. The CONTROL + "/" using the division key above the keypad instead of the "?/" key on the main keyboard. It's not nearly as convenient, but it works for me with Windows 7 and MYSQL Workbench 6.1. Show activity on this post. Instead you can also simple type "#" at the Point of line you want to comment.
Several ways:
# Comment
-- Comment
/* Comment */
Remember to put the space after --
.
See the documentation.
"A comment for a column can be specified with the COMMENT
option. The comment is displayed by the SHOW CREATE TABLE
and SHOW FULL COLUMNS
statements. This option is operational as of MySQL 4.1. (It is allowed but ignored in earlier versions.)"
As an example
--
-- Table structure for table 'accesslog'
--
CREATE TABLE accesslog (
aid int(10) NOT NULL auto_increment COMMENT 'unique ID for each access entry',
title varchar(255) default NULL COMMENT 'the title of the page being accessed',
path varchar(255) default NULL COMMENT 'the local path of teh page being accessed',
....
) TYPE=MyISAM;
You can use single line comments:
-- this is a comment
# this is also a comment
Or a multiline comment:
/*
multiline
comment
*/
From here you can use
# For single line comments
-- Also for single line, must be followed by space/control character
/*
C-style multiline comment
*/
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