MySQLはすべてのテーブルとテーブル構造を取得します

1.すべてのテーブル属性を取得します。ステートメントは次のとおりです。

select table_name tableName, 
   engine, 
   table_comment tableComment, 
   table_collation tableCollation, 
   create_time createTime 
from information_schema.tables
where table_schema = (select database())
order by create_time desc

2.テーブル構造を取得します。ステートメントは次のとおりです。

select column_name columnName, 
   data_type dataType, 
   column_comment columnComment, 
   column_key columnKey, 
   extra ,
   is_nullable as isNullable,
   column_type as columnType 
from information_schema.columns
where table_name = 't_sys_personnel' 
   and table_schema = (select database()) 
order by ordinal_position;

 

おすすめ

転載: blog.csdn.net/joyksk/article/details/113889668