Is it possible to add comments somehow, somewhere?
I don't pretend to be any sort of expert when using MySQL and certainly don't spend all day in it. More often than I would like I forget how I intend to use a column (usally the bit ones) and would be very excited if I could add a comment to remind me if 1 is good or bad, for example.
I'd be happy if it only showed up in something like 'show create table', but any obscure place within the table structures would be better and easier to find than the current post-it notes on my desk.
In MySQL, a comment that starts with /* symbol and ends with */ and can be anywhere in your SQL statement. This method of commenting can span several lines within your SQL.
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.
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.
question. C option /*COMMENT is not a valid comment Line.
http://dev.mysql.com/doc/refman/5.0/en/create-table.html
table_option:
{ENGINE|TYPE} [=] engine_name
| AUTO_INCREMENT [=] value
| AVG_ROW_LENGTH [=] value
| [DEFAULT] CHARACTER SET [=] charset_name
| CHECKSUM [=] {0 | 1}
| [DEFAULT] COLLATE [=] collation_name
| COMMENT [=] 'string'
Example:
CREATE TABLE foo (
id int(10) NOT NULL auto_increment COMMENT 'unique ID for each foo entry',
bar varchar(255) default NULL COMMENT 'the bar of the foo',
....
) TYPE=MyISAM;
You can comment columns and tables:
CREATE TABLE example (
example_column INT COMMENT="This is an example column",
another_column VARCHAR COMMENT="One more column"
) TYPE=MYISAM COMMENT="This is a comment about table";
MySQL supports comments on tables and columns which will show up on show create:
create table example (field1 char(3) comment 'first field') comment='example table'
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