Hi,

> Is it possible to put comments against a table and column that are persistent;
> so that when you run 'explain' or 'describe',  these comments will display.

Tables in MySQL (version 3.23 at least - not sure about 3.22) do actually
have a comment 'field' built in. You specify your initial comment when you
create the table, like so:

CREATE TABLE foo (bar INT, blah DATETIME, ... ) COMMENT = "Another table.";

You should also be able to change it at any time like this:

ALTER TABLE foo COMMENT = "I changed the comment.";

However, you can't get the table's comment using normal DESCRIBE statements.
It is only available through the SHOW syntax, like so:

SHOW TABLE STATUS FROM database LIKE "foo";

The column name in the output (if you're querying from Perl or PHP, etc.)
is, unsurprisingly, 'Comment'. There's also lots of other extremely useful
information to be gleaned from SHOW TABLE STATUS, such as the type of table
and date/time of creation of last update, etc.

Unfortunately, you can't tag columns with comments, though.

Regards,

------------------------------------------------
Basil Hussain ([EMAIL PROTECTED])


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to