The Information Schema COLUMNS table provides information about columns in each table on the server.

It contains the following columns:

ColumnDescription
TABLE_CATALOGAlways contains the string 'def'.
TABLE_SCHEMADatabase name.
TABLE_NAMETable name.
COLUMN_NAMEColumn name.
ORDINAL_POSITIONColumn position in the table. Can be used for ordering.
COLUMN_DEFAULTDefault value for the column.
IS_NULLABLEWhether the column can contain NULLs.
DATA_TYPEThe column's data type.
CHARACTER_MAXIMUM_LENGTHMaximum length.
CHARACTER_OCTET_LENGTHSame as the CHARACTER_MAXIMUM_LENGTH except for multi-byte character sets.
NUMERIC_PRECISIONFor numeric types, the precision (number of significant digits) for the column. NULL if not a numeric field.
NUMERIC_SCALEFor numeric types, the scale (significant digits to the right of the decimal point). NULL if not a numeric field.
DATETIME_PRECISIONFractional-seconds precision, or NULL if not a time data type.
CHARACTER_SET_NAMECharacter set if a non-binary string data type, otherwise NULL.
COLLATION_NAMECollation if a non-binary string data type, otherwise NULL.
COLUMN_TYPEColumn definition, a MySQL and MariaDB extension.
COLUMN_KEYIndex type. PRI for primary key, UNI for unique index, MUL for multiple index. A MySQL and MariaDB extension.
EXTRAAdditional information about a column. A MySQL and MariaDB extension.
PRIVILEGESWhich privileges you have for the column. A MySQL and MariaDB extension.
COLUMN_COMMENTColumn comments.

It provides information similar to, but more complete, than SHOW COLUMNS and mysqlshow.

Comments

Comments loading...