| sql.update {RPgSQL} | R Documentation |
sql.update allows a database table to modified in place.
sql.update(table, column, value, condition)
table |
A character string with the table name |
column |
The column to be modified |
value |
Data value to insert from |
condition |
An optional condition to limit the rows modified |
Adam M. Kornick
db.write.table,sql.insert,
sql.select
if (db.connection.open()) {
data(airquality)
rpgsql.test.data <- airquality[1:5,]
rm(airquality)
db.write.table(rpgsql.test.data, no.clobber=F)
db.read.table('rpgsql.test.data')
# remove ozone observations where temperature is
# greater than 70
sql.update('rpgsql.test.data', "Ozone", 0, "\"Temp\" >70")
# note that quotes were embedded around case sensitive variables
db.read.table('rpgsql.test.data')
db.rm('rpgsql.test.data', ask=F)
}