Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add or change comment for MySQL table or column?

Tags:

phpmyadmin

I'm using phpMyAdmin 3.5.1. I did all the necessary instalation and configuration steps (created the special phpmyadmin database and tables, set up the pma user etc.). My phpMyAdmin seems to indicate that everything is set correctly.

My problem is I can't see how to add a comment to a table, or to a specific column. Where is that?

like image 942
Eric Avatar asked Jun 06 '12 22:06

Eric


People also ask

How do I make a comment in MySQL?

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.

How do I see column comments in MySQL?

Comment assigned to your table will be visible at the bottom of the first tab called Info, along with other table metadata. To view comments for columns go to Columns tab, and comments will be visible in the last column in the grid.

How do I edit a column in MySQL?

The syntax to modify a column in a table in MySQL (using the ALTER TABLE statement) is: ALTER TABLE table_name MODIFY column_name column_definition [ FIRST | AFTER column_name ]; table_name. The name of the table to modify.


2 Answers

Table comments are in the "operations" tab; column comments are via editing the column.

like image 145
Sam Dufel Avatar answered Sep 26 '22 16:09

Sam Dufel


A quick reference or check-list (for phpMyAdmin version 4.0.1):

a) table comment:

  • when creating new table: below columns list, Table comments field, next to Storage Engine,

  • when changing comment for existing table: Operations > Table options > Table comments.

b) column comment: always as one of last columns (Comments) in add / change columns view.

Note, that while column's comment length is unlimited (very long anyway; managed to add comment with 2000 characters), table's comment length is limited to only 60 characters (not quite much). I don't know, from where does this limitation come from (MySQL or phpMyAdmin), but it is surely odd and should be replaced -- in most cases, you have to write a much more comment for entire table than for one column.

like image 9
trejder Avatar answered Sep 26 '22 16:09

trejder