.
1.查询当前数据库所有表结构的信息
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables where table_schema = (select database()) order by create_time desc
2.查询指定表的信息
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables where table_schema = (select database()) and table_name = 'test'
3.查询指定表的列的信息
select table_name as tableName, column_name as columnName,ordinal_position as ordinalPosition,column_default as columnDefault,is_nullable as isNullable, data_type as dataType,character_maximum_length as characterMaximumLength,numeric_precision as numericPrecision, column_comment as columnComment, column_key as columnKey, extra from information_schema.columns where table_name = 'test' and table_schema = (select database()) order by ordinal_position
这些sql的作用,主要用来做代码生成器所用,列的其他信息,可以参见:
https://blog.csdn.net/qq_40803316/article/details/84656511
不同的数据库,对于查询有不同的sql语句。