postgresqlHow do I show tables in PostgreSQL?
To show tables in PostgreSQL, you can use the command \d
or \dt
in the psql command line.
Example code
\d
Output example
List of relations
Schema | Name | Type | Owner
--------+---------------------+-------+---------
public | customers | table | postgres
public | orders | table | postgres
public | products | table | postgres
(3 rows)
The command \d
will show all the tables, views, sequences, and foreign tables in the current database. The command \dt
will only show the tables.
Parts of the code:
\d
or\dt
: These are the commands used to show the tables in PostgreSQL.public
: This is the schema of the database.customers
,orders
,products
: These are the names of the tables.table
: This is the type of the object.postgres
: This is the owner of the table.
Helpful links
More of Postgresql
- How can I set a PostgreSQL interval to zero?
- How can Zalando use PostgreSQL to improve its software development?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I view my PostgreSQL query history?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL and ZFS snapshots together?
- How can I use PostgreSQL XOR to compare two values?
- How can I use PostgreSQL's "zero if null" feature?
- How can I monitor PostgreSQL performance using Zabbix?
See more codes...