I have a MySQL database, and I have used MySQL Workbench to insert text into the "comment" fields of many of the columns and tables; the plan was to have the documentation stored in the database.
However, I do not know how to either a) add a comment to a column or, more importantly b) retrieve this information.
I have looked through the limited MySQL documentation on Describe, Show Columns, and Show Extensions.
For example, I would like to return this:
mysql> describe dogs;
+----------------+-------------------------------+
| Field | Comment |
+----------------+-------------------------------+
| id | primary key |
| Name | Dog's name |
| species_id | Foreign key to look up species|
Instead of
mysql> describe dogs;
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar (255)| YES | MUL | NULL | |
| species_id | int(11) | YES | MUL | NULL | |
Although this would do:
mysql> describe dogs;
mysql> describe dogs;
+----------------+--------------+------+-----+---------+----------------+-------------------------------+
| Field | Type | Null | Key | Default | Extra | Comment |
+----------------+--------------+------+-----+---------+----------------+-------------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment | |
| name | varchar (255)| YES | MUL | NULL | | Dog's name |
| species_id | int(11) | YES | MUL | NULL | | Foreign key to look up species|
What are my options? Does MySQL workbench export such documentation?
