mysql 数据库查看表的信息

查看正在改动的数据库:
1.
select database();

2.
status;

 
查看表的结构:
desc table_name
show columns from table_name [from database_name];

方括号表示其中内容可不必写,若要写只写括号中的内容,不写括号。

查看表的create语句——其中当然含有结构:

show create table yourTableName;

查看表的一列:

describe table_name column_name;
查询数据库中的表之间的关联信息
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;

 更新中......

猜你喜欢

转载自www.cnblogs.com/lightandtruth/p/9474123.html