Equivalent scrapbook

…scrap on Postgres

peepcode on postgres

postgress -D /var/local/var/pg_db -! /tmp/pglog # -D specify  vher db is saved, -l where log is  saved
psql
  \d  #list databases
  \d  my_db  #list tables of db 
  \d  table  #list colums
rails new --database=postgres
gem 'pg'
1255

fedora start postgress

  psql --username=postgres

mint & ubuntu postgres

sudo -u postgres psql
# be sure to include host=localhost in config/database.yml with ubuntu

# How to start / stop the server?
sudo service postgresql start / stop
sudo /etc/init.d/postgresql start / stop

source: https://zxmax.wordpress.com/2012/05/26/install-postgers-9-3-on-ubuntu-12-04/

mint ubuntu start login to postgress

 psql -d postgres -U postgres --password --host=localhost

create database

  CREATE USER tom WITH PASSWORD 'myPassword';
  CREATE DATABASE jerry;
  GRANT ALL PRIVILEGES ON DATABASE jerry to tom;

list all databasess

  \l    #list all databases

mysql: use database_name;
postgres: \c database_name;

mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;

mysql: SHOW COLUMNS
postgresql: \d table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

mysql: DESCRIBE TABLE
postgresql: \d+ table
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name ='table';

http://www.linuxscrew.com/2009/07/03/postgresql-show-tables-show-databases-show-columns/