PostgreSQL: Show tables in PostgreSQL

后端 未结 24 2598
醉梦人生
醉梦人生 2020-11-28 16:58

What\'s the equivalent to show tables (from MySQL) in PostgreSQL?

24条回答
  •  孤城傲影
    2020-11-28 17:23

    Login as a superuser so that you can check all the databases and their schemas:-

    sudo su - postgres
    

    Then we can get to postgresql shell by using following command:-

    psql
    

    You can now check all the databases list by using the following command:-

    \l
    

    If you would like to check the sizes of the databases as well use:-

    \l+
    

    Press q to go back.

    Once you have found your database now you can connect to that database using the following command:-

    \c database_name
    

    Once connected you can check the database tables or schema by:-

    \d
    

    Now to return back to the shell use:-

    q
    

    Now to further see the details of a certain table use:-

    \d table_name
    

    To go back to postgresql_shell press \q.

    And to return back to terminal press exit.

提交回复
热议问题