Show tables, describe tables equivalent in redshift

后端 未结 8 784
说谎
说谎 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:43

    Tomasz Tybulewicz answer is good way to go.

    SELECT * FROM pg_table_def WHERE tablename = 'YOUR_TABLE_NAME' AND schemaname = 'YOUR_SCHEMA_NAME';
    

    If schema name is not defined in search path , that query will show empty result. Please first check search path by below code.

    SHOW SEARCH_PATH
    

    If schema name is not defined in search path , you can reset search path.

    SET SEARCH_PATH to '$user', public, YOUR_SCEHMA_NAME
    

提交回复
热议问题