Programming/PostgreSQL/Table Queries

From Dev Wiki
< Programming‎ | PostgreSQL
Revision as of 01:35, 10 September 2021 by Brodriguez (talk | contribs) (Create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

All of the following assume you have first loaded a database.


Show Tables

\dt

Or for expanded data:

\dt+

Alternatively:

SELECT * FROM pg_catalog.pg_tables;


Show Extra Relational Data About Table

\d <table_name>


Show Table Indexes

SELECT indexname, indexdef FROM pg_indexes WHERE tablename = '<table_name>';