根据库名导出所有表信息:
SELECT
*
FROM
information_schema.`TABLES`
WHERE
TABLE_SCHEMA = 'db_name'
1
2
3
4
5
6
根据库名导出所有表名及表备注:
SELECT
TABLE_NAME,
TABLE_COMMENT
FROM
information_schema.`TABLES`
WHERE
TABLE_SCHEMA = 'db_name';
1
2
3
4
5
6
7
mysql获取整个库的所有表,及表结构:
SELECT
TABLE_SCHEMA AS '库名',
TABLE_NAME AS '表名',
COLUMN_NAME AS '列名',
ORDINAL_POSITION AS '列的排列顺序',
COLUMN_DEFAULT AS '默认值',
IS_NULLABLE AS '是否为空',
DATA_TYPE AS '数据类型',
CHARACTER_MAXIMUM_LENGTH AS '字符最大长度',
NUMERIC_PRECISION AS '数值精度(最大位数)',
NUMERIC_SCALE AS '小数精度',
COLUMN_TYPE AS '列类型',
COLUMN_KEY 'KEY',
EXTRA AS '额外说明',
COLUMN_COMMENT AS '注释'
FROM
information_schema.`COLUMNS`
WHERE
TABLE_SCHEMA = 'db_name'
ORDER BY
TABLE_NAME,
ORDINAL_POSITION;
————————————————
原文链接:https://blog.csdn.net/zhezhebie/article/details/108258387