Learn R Programming

pgTools (version 1.0.2)

DELETE: Generate a PostgreSQL DELETE statement, optionally execute the statement if con is not NULL.

Description

Generate a PostgreSQL DELETE statement, optionally execute the statement if con is not NULL.

Usage

DELETE(schema = NULL, table, where = NULL, con = NULL)

Value

A string, PostgreSQL DELETE statement; or the results retrieved by DBI::dbGetQuery after executing the statement.

Arguments

schema

A string, the schema name of the SQL table to DELETE from.

table

A string, the table name of the SQL table to DELETE from.

where

A named list, names are the columns for comparison, values are lists with a comparison operator and a value the comparison operator will check against. ex: list(col1 = list(comparison = "=", value = quoteText("b")))

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

Examples

Run this code
DELETE(
schema = "test",
table = "table1",
where = list(
  col1 = list(comparison = "=", value = quoteText("b")),
  col2 = list(comparison = "IS", value = "NULL")
)
)

Run the code above in your browser using DataLab