Description Usage Arguments Details Value Note Author(s) See Also Examples
Create string with SQL expressions for WHERE
clause
to join two tables on the given columns.
1 | natural_key(table_names, key_columns)
|
table_names |
[character(2)] |
key_columns |
[character(1:Inf)] |
The names of tables and key columns must be valid SQL identifiers.
They are validated to conform to
the regular expression returned by valid_identifier_regex
.
The SQL string is created in 3 steps:
Combine table names with key names, eg, "PRL.FLIGHT_NR
".
Create logical expressions, eg, "PRL.FLIGHT_NR = PRL_SSR.FLIGHT_NR
"
Concatenate logical expressions by "and"
to form final SQL esxpression.
Character string to be used in SQL statement.
The current implementation assumes that key columns have the same names in both tables.
Uwe Block
1 2 3 4 5 | # SQL expression
(sql_expr <- lazysql::natural_key(c("TAB1", "tab_2"),c("COL1", "col_2")))
# sample SQL JOIN statement
paste("select * from TAB1, TAB2 where", sql_expr)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.