Skip to content

Instantly share code, notes, and snippets.

@zackn9ne
Created May 8, 2014 15:49
Show Gist options
  • Save zackn9ne/ae81cdfa1b0b4b56f229 to your computer and use it in GitHub Desktop.
Save zackn9ne/ae81cdfa1b0b4b56f229 to your computer and use it in GitHub Desktop.
PSQL CHECKING COMMANDS
1. $psql
2. =# \l List All The DB's
2. =# \c dbname CHANGE TO IT
3. dbname=# \d List All The Relations
4. dbname=# SELECT * FROM relation_of_your_choice;
PSQL CREATING COMMANDS
1. $psql
2. =# CREATE DATABASE dbname;
3. =# \c dbname CHANGE TO IT
4. dbname=# \d List All The Relations
5. dbname=# SELECT * FROM relation_of_your_choice;
EXTRA INFO
\l List all databases
\c dbname Change db
\d Display all tables in database
\d tablename Describe the details of given table
\h Get a help on syntax of SQL commands
\? Lists all psql slash commands.
\q Quit psql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment