This is Devhints.io cheatsheets — a collection of cheatsheets I've written.

# PostgreSQL

Replace anything within `<placeholder>` accordingly

### Console

    $ 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`
- Connect to a database: `\c <database>`
- Show columns of a table: `\d <table>` or `\d+ <table>`
- Quit: `\q`

### Creating database

     $ createdb databasename

Devhints.io cheatsheets is a collection of cheatsheets I've written over the years. Suggestions and corrections? Send them in. I'm Rico Sta. Cruz. Check out my Today I learned blog for more.