Re: question about "SHOW COLUMNS FROM table like 'colmunname'"
I don't know what your question is. Here are two ways to do something like what you said:
mysql> SHOW COLUMNS FROM messages like 'dt';
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| dt | datetime | NO | MUL | NULL | |
+-------+----------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> SELECT * FROM information_schema.COLUMNS
mysql> WHERE table_name = 'messages'
mysql> AND COLUMN_NAME = 'dt' \G
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: my_dbname
TABLE_NAME: messages
COLUMN_NAME: dt
ORDINAL_POSITION: 5
COLUMN_DEFAULT: NULL
IS_NULLABLE: NO
DATA_TYPE: datetime
CHARACTER_MAXIMUM_LENGTH: NULL
CHARACTER_OCTET_LENGTH: NULL
NUMERIC_PRECISION: NULL
NUMERIC_SCALE: NULL
DATETIME_PRECISION: 0
CHARACTER_SET_NAME: NULL
COLLATION_NAME: NULL
COLUMN_TYPE: datetime
COLUMN_KEY: MUL
EXTRA:
PRIVILEGES: select,insert,update,references
COLUMN_COMMENT:
1 row in set (0.02 sec)
Subject
Written By
Posted
Re: question about "SHOW COLUMNS FROM table like 'colmunname'"
July 31, 2014 10:52PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.