Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(RPostgreSQL) #import the library
- driver <- dbDriver('PostgreSQL') #define the database driver
- db <- dbConnect(driver, host='foobar_host', #set the host to the postgreSQL IP or alias
- user='foo_bar', #input username
- password='my_secret_code', #input your password
- dbname='my_gp_db') #input the name of the databse
- myquery <- "SELECT
- col_one
- ,col_two
- ,col_three
- FROM table_one a
- INNER JOIN table_two b
- ON a.id = b.a_id
- WHERE
- a.created_date > 2012
- LIMIT 100;"
- my.data <- dbGetQuery(db, myquery) #assign results to a vector
Add Comment
Please, Sign In to add comment