Created
December 10, 2013 19:25
-
-
Save greyaperez/7896571 to your computer and use it in GitHub Desktop.
Common/Important PostgreSQL Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Common/Important Commands | |
# See Cheatsheet - http://www.postgresonline.com/downloads/special_feature/postgresql83_cheatsheet.pdf | |
# Admin | |
psql | |
\list lists all databases | |
\dt lists all tables in the current database | |
\q quit | |
# Import SQL File | |
\i {sql file} | |
CREATE DATABASE "store" | |
WITH OWNER "postgres" | |
ENCODING 'UTF8' | |
LC_COLLATE = 'en_US.UTF-8' | |
LC_CTYPE = 'en_US.UTF-8'; | |
CREATE TABLE orders( | |
order_id serial NOT NULL, | |
order_addeddt timestamp without time zone, | |
order_rating rating, | |
CONSTRAINT pk_orders_order_id PRIMARY KEY (order_id) | |
) | |
WITH (OIDS=FALSE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment