该系统表包含了所有表的列信息
The COLUMNS table provides information about columns in tables.
INFORMATION_SCHEMA Name | SHOW Name | Remarks |
|---|---|---|
TABLE_CATALOG | def | |
TABLE_SCHEMA | ||
TABLE_NAME | ||
COLUMN_NAME | Field | |
ORDINAL_POSITION | see notes | |
COLUMN_DEFAULT | Default | |
IS_NULLABLE | Null | |
DATA_TYPE | Type | |
CHARACTER_MAXIMUM_LENGTH | Type | |
CHARACTER_OCTET_LENGTH | ||
NUMERIC_PRECISION | Type | |
NUMERIC_SCALE | Type | |
DATETIME_PRECISION | Type | |
CHARACTER_SET_NAME | ||
COLLATION_NAME | Collation | |
COLUMN_TYPE | Type | MySQL extension |
COLUMN_KEY | Key | MySQL extension |
EXTRA | Extra | MySQL extension |
PRIVILEGES | Privileges | MySQL extension |
COLUMN_COMMENT | Comment | MySQL extension |
GENERATION_EXPRESSION | MySQL extension |
Notes:
-
In
SHOW, theTypedisplay includes values from several differentCOLUMNScolumns. -
ORDINAL_POSITIONis necessary because you might want to sayORDER BY ORDINAL_POSITION. UnlikeSHOW,SELECTdoes not have automatic ordering. -
CHARACTER_OCTET_LENGTHshould be the same asCHARACTER_MAXIMUM_LENGTH, except for multibyte character sets. -
CHARACTER_SET_NAMEcan be derived fromCollation. For example, if you saySHOW FULL COLUMNS FROM t, and you see in theCollationcolumn a value oflatin1_swedish_ci, the character set is what is before the first underscore:latin1. -
GENERATION_EXPRESSIONis nonempty for generated columns and displays the expression used to compute column values. For information about generated columns, see Section 13.1.18.8, “CREATE TABLE and Generated Columns”. -
The
EXTRAcolumn containsVIRTUAL GENERATEDorVIRTUAL STOREDfor generated columns.
本文介绍了COLUMNS系统表的内容,该表提供了数据库中各表列的详细信息,包括列名、数据类型、默认值等属性,并解释了这些信息如何用于理解和管理数据库结构。
1894

被折叠的 条评论
为什么被折叠?



