Risposte:
Diversi modi:
# Comment
-- Comment
/* Comment */
Ricorda di mettere lo spazio dopo-- .
Vedere la documentazione .
"È possibile specificare un commento per una colonna con l' COMMENTopzione. Il commento viene visualizzato dalle istruzioni SHOW CREATE TABLEe SHOW FULL COLUMNS. Questa opzione è operativa a partire da MySQL 4.1. (È consentita ma ignorata nelle versioni precedenti.)"
Come esempio
--
-- Table structure for table 'accesslog'
--
CREATE TABLE accesslog (
aid int(10) NOT NULL auto_increment COMMENT 'unique ID for each access entry',
title varchar(255) default NULL COMMENT 'the title of the page being accessed',
path varchar(255) default NULL COMMENT 'the local path of teh page being accessed',
....
) TYPE=MyISAM;
Sono supportati tre tipi di commenti
Hash base per commenti a riga singola usando #
Select * from users ; # this will list users
Select * from users ; -- this will list users
Nota: è importante disporre di un singolo spazio bianco subito dopo -
3) Commenti su più righe usando / * * /
Select * from users ; /* this will list users */
/* comment here */
ecco un esempio: SELECT 1 /* this is an in-line comment */ + 1;
--