OSDN Git Service

Regular updates
[twpd/master.git] / postgresql.md
1 ---
2 title: PostgreSQL
3 category: Databases
4 ---
5
6 Replace anything within `<placeholder>` accordingly
7
8 ### Console
9
10     $ psql #logs in to default database & default user
11     $ sudo -u <rolename:postgres> psql #logs in with a particular user
12
13 ### Commands
14
15  * Show roles: `\du`
16  * Show tables: `\dt`
17  * Show databases: `\l`
18  * Connect to a database: `\c <database>`
19  * Show columns of a table: `\d <table>` or `\d+ <table>`
20  * Quit: `\q`
21
22 ### Creating database
23
24      $ createdb databasename