【问题标题】:Redshift view all tables across all schemasRedshift 查看所有模式中的所有表
【发布时间】:2021-03-15 06:43:47
【问题描述】:

我有一个包含多个模式的红移数据库。每个模式包含多个表。 我需要搜索一个特定的表,但我不知道它驻留在哪个模式中。 有没有可以用来获取所有架构中所有表的名称的查询?

预期 o/p:

Schema 1  table 1
Schema 1  table 2
Schema 2  table 1
......

【问题讨论】:

    标签: sql amazon-redshift


    【解决方案1】:

    在 Redshift 中,您可以使用information_schema.tables 系统表来获取表及其架构详细信息。 请注意,您可能没有访问此表的权限。请您的数据库管理员执行以下查询并获取详细信息。

    select t.table_schema, t.table_name
    from information_schema.tables t
    where t.table_name = 'test1' -- Your Table Name
    order by t.table_name;
    
     table_schema  | table_name
    ---------------+------------
     public        | test1
     sample_schema | test1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-08-21
      • 2020-08-04
      • 2020-10-02
      • 2018-10-11
      • 2013-12-25
      • 1970-01-01
      • 2019-05-23
      • 1970-01-01
      相关资源
      最近更新 更多