要列出表的元数据,您可以按表架构或表名进行查询。
例 – 按架构列出表
以下查询列出了使用 rdspostgresql
表架构的表。
SELECT table_schema,
table_name,
table_type
FROM information_schema.tables
WHERE table_schema = 'rdspostgresql'
下图显示了一个示例结果。
table_schema | table_name | table_type | |
---|---|---|---|
1 | rdspostgresql | rdspostgresqldb1_public_account | BASE TABLE |
例 – 按名称搜索表
以下查询获取表 athena1
的元数据信息。
SELECT table_schema,
table_name,
table_type
FROM information_schema.tables
WHERE table_name = 'athena1'
下图显示了一个示例结果。
table_schema | table_name | table_type | |
---|---|---|---|
1 | 默认值 | athena1 | BASE TABLE |