Skip to content

Instantly share code, notes, and snippets.

@NaserKhoshfetrat
Created May 8, 2024 05:51
Show Gist options
  • Save NaserKhoshfetrat/c5e7cef6dd2b8be7c1f7b8633a293daf to your computer and use it in GitHub Desktop.
Save NaserKhoshfetrat/c5e7cef6dd2b8be7c1f7b8633a293daf to your computer and use it in GitHub Desktop.
postgres Psql
#login as superuser into postgres super user
.\psql.exe -u postgres
#show all database
\l
#change the current database to the one that you want to show tables:
\c testDb
# command from the PostgreSQL command prompt to show tables in the selected database:
# (+ :will add the size and description columns)
\dt+
# show details of a specific table, you can specify the name of the table after the \d command:
\d+ table_name
#Query
SELECT * FROM table_name order by id desc limit 100;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment