Description Usage Arguments See Also Examples
Build a Simple SQL Query
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | build_query(
fields = "*",
distinct = FALSE,
schema,
table,
where_in_field,
where_in_vector,
where_not_in_field,
where_not_in_vector,
where_is_null_field,
where_is_not_null_field,
case_insensitive = TRUE,
limit,
random
)
|
fields |
Fields selected for. Defaults to "*". |
distinct |
If TRUE, the distinct row count will be returned. |
schema |
The target schema for the operation. |
table |
Target table for the operation. |
where_in_field |
Paired with |
where_not_in_field |
Paired with |
case_insensitive |
If TRUE, both sides of the query are converted to lowercase. |
limit |
(Optional) Integer of the row limit. Takes precedence over |
random |
(Optional) Integer of the random number of rows to return. Is preceded by |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Building SQL Statements using R
library(pg13)
# Build a Simple Query
build_query(schema = "public",
table = "concept_synonym")
build_query(distinct = TRUE,
schema = "public",
table = "concept_synonym")
build_query(fields = c("concept_id", "concept_name"),
distinct = TRUE,
schema = "public",
table = "concept_synonym")
# WHERE filters may be applied, but will be ignored if the field-value pair is not provided
build_query(fields = c("concept_id", "concept_name"),
schema = "public",
table = "concept_synonym",
where_in_field = "concept_synonym")
# The query defaults to transforming elements to lowercase for case insensitivity that can be turned off
build_query(fields = c("concept_id", "concept_name"),
schema = "public",
table = "concept_synonym",
where_in_field = "concept_synonym",
where_in_vector = c("Myocardial Infarction", "Heart Attack"))
build_query(fields = c("concept_id", "concept_name"),
schema = "public",
table = "concept_synonym",
where_in_field = "concept_synonym",
where_in_vector = c("Myocardial Infarction", "Heart Attack"),
case_insensitive = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.