您的位置:首页 > 其它

information_schema系统表——COLUMNS

2017-11-15 15:30 736 查看
该系统表包含了所有表的列信息

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
,
the 
Type
 display includes values from
several different 
COLUMNS
 columns.

ORDINAL_POSITION
 is necessary because
you might want to say 
ORDER BY ORDINAL_POSITION
.
Unlike 
SHOW
SELECT
 does
not have automatic ordering.

CHARACTER_OCTET_LENGTH
 should be the
same as 
CHARACTER_MAXIMUM_LENGTH
, except
for multibyte character sets.

CHARACTER_SET_NAME
 can be derived from 
Collation
.
For example, if you say 
SHOW FULL COLUMNS FROM
t
, and you see in the 
Collation
 column
a value of
latin1_swedish_ci
, the character
set is what is before the first underscore: 
latin1
.

GENERATION_EXPRESSION
 is 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 
EXTRA
 column contains 
VIRTUAL
GENERATED
 or 
VIRTUAL STORED
 for
generated columns.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息