Add more basic psql commands

This commit is contained in:
Yonas 2018-03-23 16:13:30 +08:00
parent f835036173
commit f04327d1c5
1 changed files with 8 additions and 2 deletions

View File

@ -2,15 +2,21 @@
title: PostgreSQL
---
Replace anything within <placeholder> accordingly
### Console
$ psql
$ psql #logs in to default database & default user
$ sudo -u <rolename:postgres> psql #logs in with a particular user
### Commands
* Show roles: `\du`
* Show tables: `\dt`
* Show databases: `\l`
* Show columns of a table: `\d table` or `\d+ table`
* Connect to a database: `\c <database>`
* Show columns of a table: `\d <table>` or `\d+ <table>`
* Quit: `\q`
### Creating database