mysql查询数据库所有的表以及字段信息
SELECT
table_schema 数据库名,
table_name 表名,
COLUMN_NAME 列名,
COLUMN_TYPE 数据类型,
DATA_TYPE 字段类型,
CHARACTER_MAXIMUM_LENGTH 长度,
IS_NULLABLE 是否为空,
COLUMN_DEFAULT 默认值,
COLUMN_COMMENT 备注
FROM
INFORMATION_SCHEMA.COLUMNS
where
-- table_schema 为库名
table_schema ='XXX'
AND
-- table_name为表名
table_name in (SELECT table_name FROM (SELECT table_name, table_comment, create_time, update_time FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE())
ORDER BY create_time DESC) as t )文章来源:https://www.toymoban.com/news/detail-480583.html
clickhouse导出表信息
SELECT
database AS `数据库名`,
table AS `表名`,
name AS `列名`,
type AS `类型`,
default_expression AS `默认值`,
numeric_precision AS `数字精度`,
numeric_scale AS `小数位数`,
comment AS `字段说明`
FROM
system.columns
WHERE
database='default' 文章来源地址https://www.toymoban.com/news/detail-480583.html
到了这里,关于mysql、clickhouse查询数据库所有的表以及字段信息的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!