show tables information
除了查询数据,管理数据之外,还有其他方面的信息方便和约束着
-- show information about characterset,查询mysql的编码
SHOW VARIABLES LIKE '%char%';
-- show all relationships between tables in database your_databases; 查询数据库中的表之间的关联信息
select TABLE_NAME , COLUMN_NAME ,
REFERENCED_TABLE_NAME , REFERENCED_COLUMN_NAME
from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
where CONSTRAINT_SCHEMA = 'your_databases' and
REFERENCED_TABLE_SCHEMA is not null and
REFERENCED_TABLE_NAME is not null and
REFERENCED_COLUMN_NAME is not null;
REFERENCED_TABLE_NAME , REFERENCED_COLUMN_NAME
from INFORMATION_SCHEMA.KEY_COLUMN_USAGE
where CONSTRAINT_SCHEMA = 'your_databases' and
REFERENCED_TABLE_SCHEMA is not null and
REFERENCED_TABLE_NAME is not null and
REFERENCED_COLUMN_NAME is not null;
-- engines information
SHOW ENGINES;