in_condition: Create SQL string to select values included in a set of given...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Create string with SQL IN expression for WHERE clause to select values included in a set of given values.

Usage

1
in_condition(column_name, choices, negation = c("", "not"))

Arguments

column_name

[character(1)]
Name of data base column to select values from.

choices

[character(1:Inf)] or [integer(1:Inf)]
The values which must be matched. Character values must not contain any single or double quotes to avoid problems with SQL syntax and for safety reasons.

negation

[character(1)]
If "not" the selection is inverted to a NOT IN expression.

Details

column_name must be a valid SQL identifier. It is validated to conform to the regular expression returned by valid_identifier_regex.

Value

Character string to be used in SQL statement.

Author(s)

Uwe Block

See Also

valid_identifier_regex.

Examples

1
2
3
4
5
6
7
8
# SQL expressions
lazysql::in_condition("COL_1", 1:3)

lazysql::in_condition("COL_1", 1:3, "not")

lazysql::in_condition("COL_1", LETTERS[2:3])

lazysql::in_condition("COL_1", LETTERS[2:3], "not")

UweBlock/lazysql documentation built on May 9, 2019, 9:41 p.m.