Jump to content

Add a Comment to a mysql key/index


The Letter E

Recommended Posts

I have scoured the internets  for the information I seek and tried the most logical conventions I could think of to achieve the desired results, to no avail.

 

Here's the problem... I want to add a comment to my indexes for different columns.

 

so when I run the following line in mysql

show indexes from tableName;

 

I will see some data in the Comment field

 

+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+

| Table    | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | <----- last field in result set

+----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+

| listings |          0 | PRIMARY  |            1 | id          | A        |          0 |    NULL | NULL  |      | BTREE      |        |

| listings |          1 | user_id  |            1 | user_id    | A        |          0 |    NULL | NULL  | YES  | BTREE      |        |

 

I have no idea how to add a comment to a key, whether it be on create index, alter table, or create table methods.

 

Any help is greatly appreciated.

 

Thanks,

 

E

Link to comment
https://forums.phpfreaks.com/topic/262217-add-a-comment-to-a-mysql-keyindex/
Share on other sites

I think you have to put it on the column, not the index.

 

Thanks for the response. I just figured out the problem. Index comments are not available in my current mysql version, 5.1.  I need to upgrade to 5.5.

 

http://dev.mysql.com/doc/refman/5.5/en/create-index.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.