DROP TABLE IF EXISTS test_comments;
Query OK, 0 rows affected (0.08 sec)
CREATE TABLE test_comments (ID INT, name CHAR(30)) COMMENT 'Hello World';
Query OK, 0 rows affected (0.22 sec)
Verifique seus comentários na estrutura da tabela
show create table test_comments\G
*************************** 1. row ***************************
Table: test_comments
Create Table: CREATE TABLE `test_comments` (
`ID` int(11) DEFAULT NULL,
`name` char(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Hello World'
1 row in set (0.00 sec)
Você também pode verificar os comentários de information_schema como abaixo
SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'test_comments';
+---------------+
| TABLE_COMMENT |
+---------------+
| Hello World |
+---------------+
1 row in set (0.00 sec)
Alterar tabela para modificar comentários
ALTER TABLE test_comments COMMENT = 'This is just to test how to alter comments';
Query OK, 0 rows affected (0.08 sec)
Records: 0 Duplicates: 0 Warnings: 0
Verifique os comentários modificados
show create table test_comments\G
*************************** 1. row ***************************
Table: test_comments
Create Table: CREATE TABLE `test_comments` (
`ID` int(11) DEFAULT NULL,
`name` char(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='This is just to test how to alter comments'
1 row in set (0.00 sec)
SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'test_comments';
+--------------------------------------------+
| TABLE_COMMENT |
+--------------------------------------------+
| This is just to test how to alter comments |
+--------------------------------------------+
1 row in set (0.00 sec)
column_comment
deinformation_schema.columns
(desde que sejaalter table ...
necessário especificar novamente toda a definição de coluna)?