Skip to content

Instantly share code, notes, and snippets.

@ryumada
Last active October 2, 2023 09:51
Show Gist options
  • Save ryumada/bd03aaed0c32deb54fea1e1d73f1ddce to your computer and use it in GitHub Desktop.
Save ryumada/bd03aaed0c32deb54fea1e1d73f1ddce to your computer and use it in GitHub Desktop.
basic psql commands cheatsheet PostgreSQL

basic psql commands for easy read

commands description
GRANT ALL PRIVILEGES ON DATABASE <<nama database>> TO <<nama user>>; Query to grant All Previledges to a user
sudo -u postgres psql Linux ubuntu login to superadmin
CREATE USER <<nama user>> WITH ENCRYPTED PASSWORD '<<password>>'; Query to create user
\l get database list in the postgres server
\c database_name connect to a database (You need to connect to a database first before you can run the below commands)
\d table_name show table details
\dt show table list in the schema
\dt+ List all tables details with detailed information
Row5
Row6
Row7
Row8
Row9
Row10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment