列出数据库并搜索指定的数据库
本节中的示例演示如何按模式名称列出元数据中的数据库。
例 – 列出数据库
以下示例查询列出 information_schema.schemata 表中的数据库。
SELECT schema_name FROM information_schema.schemata LIMIT 10;
下表显示了示例结果。
| 6 | alb-databas1 |
| 7 | alb_original_cust |
| 8 | alblogsdatabase |
| 9 | athena_db_test |
| 10 | athena_ddl_db |
例 – 搜索指定的数据库
在以下示例查询中,rdspostgresql 是示例数据库。
SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'rdspostgresql'
下表显示了示例结果。
| schema_name | |
|---|---|
| 1 | rdspostgresql |