Information Schema COLUMNS Table
The Information Schema COLUMNS table provides information about columns in each table on the server, including data types, defaults, and nullability.
The Information Schema COLUMNS table provides information about columns in each table on the server.
It contains the following columns:
TABLE_CATALOG
Always contains the string 'def'.
TABLE_SCHEMA
Database name.
TABLE_NAME
Table name.
COLUMN_NAME
Column name.
ORDINAL_POSITION
Column position in the table. Can be used for ordering.
COLUMN_DEFAULT
Default value for the column. Literals are quoted to distinguish them from expressions. NULL means that the column has no default.
IS_NULLABLE
Whether the column can contain NULLs.
DATA_TYPE
The column's data type.
CHARACTER_MAXIMUM_LENGTH
Maximum length.
CHARACTER_OCTET_LENGTH
Same as the CHARACTER_MAXIMUM_LENGTH except for multi-byte character sets.
NUMERIC_PRECISION
For numeric types, the precision (number of significant digits) for the column. NULL if not a numeric field.
NUMERIC_SCALE
For numeric types, the scale (significant digits to the right of the decimal point). NULL if not a numeric field.
DATETIME_PRECISION
Fractional-seconds precision, or NULL if not a time data type.
CHARACTER_SET_NAME
Character set if a non-binary string data type, otherwise NULL.
COLLATION_NAME
Collation if a non-binary string data type, otherwise NULL.
COLUMN_TYPE
Column definition, a MySQL and MariaDB extension.
COLUMN_KEY
Index type. PRI for primary key, UNI for unique index, MUL for multiple index. A MySQL and MariaDB extension.
EXTRA
Additional information about a column, for example whether the column is an invisible column, or WITHOUT SYSTEM VERSIONING if the table is not a system-versioned table. A MySQL and MariaDB extension.
PRIVILEGES
Which privileges you have for the column. A MySQL and MariaDB extension.
COLUMN_COMMENT
Column comments.
IS_GENERATED
Indicates whether the column value is generated (virtual, or computed). Can be ALWAYS or NEVER.
GENERATION_EXPRESSION
The expression used for computing the column value in a generated (virtual, or computed) column.
IS_SYSTEM_TIME_PERIOD_START
From MariaDB 11.4.1.
IS_SYSTEM_TIME_PERIOD_END
From MariaDB 11.4.1.
It provides information similar to, but more complete, than SHOW COLUMNS and mariadb-show.
Examples
In the results above, the two single quotes in concat(''A'',''B'') indicate an escaped single quote - see string-literals. Note that while mariadb client appears to show the same default value for columns s5 and s6, the first is a 4-character string "NULL", while the second is the SQL NULL value.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

