Show tables, describe tables equivalent in redshift

后端 未结 8 786
说谎
说谎 2021-01-30 03:17

I\'m new to aws, can anyone tell me what are redshifts\' equivalents to mysql commands?

show tables -- redshift command
describe table_name -- redshift command
<         


        
8条回答
  •  日久生厌
    2021-01-30 03:39

    All the information can be found in a PG_TABLE_DEF table, documentation.

    Listing all tables in a public schema (default) - show tables equivalent:

    SELECT DISTINCT tablename
    FROM pg_table_def
    WHERE schemaname = 'public'
    ORDER BY tablename;
    

    Description of all the columns from a table called table_name - describe table equivalent:

    SELECT *
    FROM pg_table_def
    WHERE tablename = 'table_name'
    AND schemaname = 'public';
    

提交回复
热议问题