2023-12-26 22:31:51 +08:00
|
|
|
--MYSQL_DBS 数据库名信息
|
|
|
|
|
SELECT
|
|
|
|
|
SCHEMA_NAME AS dbname
|
|
|
|
|
FROM
|
|
|
|
|
information_schema.SCHEMATA
|
|
|
|
|
WHERE
|
|
|
|
|
SCHEMA_NAME NOT IN ('mysql', 'information_schema', 'performance_schema')
|
|
|
|
|
---------------------------------------
|
2023-05-24 12:32:17 +08:00
|
|
|
--MYSQL_TABLE_INFO 表详细信息
|
|
|
|
|
SELECT
|
|
|
|
|
table_name tableName,
|
|
|
|
|
table_comment tableComment,
|
|
|
|
|
table_rows tableRows,
|
|
|
|
|
data_length dataLength,
|
|
|
|
|
index_length indexLength,
|
|
|
|
|
create_time createTime
|
|
|
|
|
FROM
|
|
|
|
|
information_schema.tables
|
|
|
|
|
WHERE
|
2023-11-02 12:46:21 +08:00
|
|
|
table_type = 'BASE TABLE'
|
|
|
|
|
AND table_schema = (
|
2023-05-24 12:32:17 +08:00
|
|
|
SELECT
|
|
|
|
|
database ()
|
|
|
|
|
)
|
2023-06-17 16:04:21 +08:00
|
|
|
---------------------------------------
|
2023-05-24 12:32:17 +08:00
|
|
|
--MYSQL_INDEX_INFO 索引信息
|
|
|
|
|
SELECT
|
|
|
|
|
index_name indexName,
|
|
|
|
|
column_name columnName,
|
|
|
|
|
index_type indexType,
|
|
|
|
|
non_unique nonUnique,
|
|
|
|
|
SEQ_IN_INDEX seqInIndex,
|
|
|
|
|
INDEX_COMMENT indexComment
|
|
|
|
|
FROM
|
|
|
|
|
information_schema.STATISTICS
|
|
|
|
|
WHERE
|
|
|
|
|
table_schema = (
|
|
|
|
|
SELECT
|
|
|
|
|
database ()
|
|
|
|
|
)
|
|
|
|
|
AND table_name = '%s'
|
|
|
|
|
ORDER BY
|
|
|
|
|
index_name asc,
|
|
|
|
|
SEQ_IN_INDEX asc
|
2023-06-17 16:04:21 +08:00
|
|
|
---------------------------------------
|
2023-05-24 12:32:17 +08:00
|
|
|
--MYSQL_COLUMN_MA 列信息元数据
|
|
|
|
|
SELECT
|
|
|
|
|
table_name tableName,
|
|
|
|
|
column_name columnName,
|
|
|
|
|
column_type columnType,
|
|
|
|
|
column_default columnDefault,
|
|
|
|
|
column_comment columnComment,
|
|
|
|
|
column_key columnKey,
|
|
|
|
|
extra extra,
|
2023-11-23 10:36:20 +08:00
|
|
|
is_nullable nullable,
|
|
|
|
|
NUMERIC_SCALE numScale
|
2023-05-24 12:32:17 +08:00
|
|
|
from
|
|
|
|
|
information_schema.columns
|
|
|
|
|
WHERE
|
|
|
|
|
table_schema = (
|
|
|
|
|
SELECT
|
|
|
|
|
database ()
|
|
|
|
|
)
|
|
|
|
|
AND table_name in (%s)
|
|
|
|
|
ORDER BY
|
|
|
|
|
tableName,
|
|
|
|
|
ordinal_position
|