INFORMATION_SCHEMA Name | SHOW Name |
TABLE_CATALOG | |
TABLE_SCHEMA | |
TABLE_NAME | Table |
NON_UNIQUE | Non_unique |
INDEX_SCHEMA | |
INDEX_NAME | Key_name |
SEQ_IN_INDEX | Seq_in_index |
COLUMN_NAME | Column_name |
COLLATION | Collation |
CARDINALITY | Cardinality |
SUB_PART | Sub_part |
PACKED | Packed |
NULLABLE | Null |
INDEX_TYPE | Index_type |
COMMENT | Comment |
INDEX_COMMENT | Index_comment |
SELECT * FROM INFORMATION_SCHEMA.STATISTICS WHERE table_name = ‘tbl_name‘ AND table_schema = ‘db_name‘
类似于
SHOW INDEX FROM tbl_name FROM db_name
也可以查看表里面有多少个索引:
select distinct INDEX_NAME from information_schema.statistics WHERE TABLE_SCHEMA=‘qiandai‘ and TABLE_NAME=‘t1‘;
再SHOW INDEX FROM tbl_name FROM db_name查看每个索引的详细信息。
INFORMATION_SCHEMA Name | SHOW Name |
TABLESPACE_NAME | |
ENGINE | |
TABLESPACE_TYPE | 类型 |
LOGFILE_GROUP_NAME | |
EXTENT_SIZE | |
AUTOEXTEND_SIZE | |
MAXIMUM_SIZE | |
NODEGROUP_ID | |
TABLESPACE_COMMENT |
INFORMATION_SCHEMA Name | SHOW Name |
CONSTRAINT_CATALOG | 描述 |
CONSTRAINT_SCHEMA | 相关schema |
CONSTRAINT_NAME | 名字 |
TABLE_SCHEMA | 表schema |
TABLE_NAME | 表名 |
CONSTRAINT_TYPE | 约束的类型 |
select * from information_schema.TABLE_CONSTRAINTS where TABLE_SCHEMA=‘qiandai‘ and table_name=‘t1‘ ;
4:TABLE_PRIVILEGES
INFORMATION_SCHEMA Name | SHOW Name |
GRANTEE | |
TABLE_CATALOG | |
TABLE_SCHEMA | |
TABLE_NAME | |
PRIVILEGE_TYPE | |
IS_GRANTABLE |
INFORMATION_SCHEMA Name | SHOW Name |
GRANTEE | |
TABLE_CATALOG | |
PRIVILEGE_TYPE | |
IS_GRANTABLE |
information_schema系列六(索引,表空间,权限,约束相关表)
原文:http://www.cnblogs.com/shengdimaya/p/6891695.html