Podemos escrever um comentário para criar uma tabela:
create database `mytest`;
use `mytest`;
create table `mytest` (
/* mytest mytest */
`code` varchar(15) NOT NULL,
`type` varchar(20) NOT NULL
);
Como pode mostrar o comentário /* mytest mytest */
no comando create table?
show create table mytest;
+--------+------------------------------------+
| Table | Create Table |
+--------+------------------------------------+
| mytest | CREATE TABLE `mytest` (
`code` varchar(15) NOT NULL,
`type` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
Esse tipo de comentário não é armazenado na definição da tabela, portanto, você não pode obtê-lo com SQL.
Uma solução é fazer isso:
Isso dá :
Ou melhor :
Dando :
Você também pode ter comentários em nível de coluna :
Dá: