1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| ## use information_schema
SELECT T.TABLE_SCHEMA AS '数据库名称', T.TABLE_NAME AS '表名', C.ORDINAL_POSITION AS '字段编号', C.COLUMN_NAME AS '字段名', C.COLUMN_TYPE AS '数据类型', C.IS_NULLABLE AS '允许为空', C.COLUMN_KEY AS '键类型', C.EXTRA AS '自增属性', C.CHARACTER_SET_NAME AS '编码名称', C.COLUMN_COMMENT AS '字段说明' FROM COLUMNS C INNER JOIN TABLES T ON C.TABLE_SCHEMA = T.TABLE_SCHEMA AND C.TABLE_NAME = T.TABLE_NAME WHERE T.TABLE_SCHEMA = 'mysql' ### 要导出的数据库 ## 将查询结果导出
|