-
Notifications
You must be signed in to change notification settings - Fork 409
Variables
Daniël van Eeden edited this page Mar 13, 2024
·
11 revisions
-
BigQuery: identifier syntax, and
@@variable
for system variables. - DB2: identifier syntax
- DB2i: identifier syntax
-
Hive:
${hivevar:name}
,${hiveconf:name}
,${system:name}
or${name}
. These are substitution variables (as in Oracle SQL terminology). They behave more like string-interpolation, that is, the values aren't automatically escaped by the system. A common example is to place the variable inside a string:SELECT * FROM users WHERE name = '${hivevar:USER_NAME}'
. Also one can use the variable to parameterize table or column name (SELECT * FROM ${hivevar:my_table}
). See also post in StackOverflow. -
MariaDB:
@name
(where the name consists of alphanumeric characters,.
,_
, and$
),@'var name'
,@"var name"
,@`var name`
(can be quoted as string or identifier). Also@@name
for system variables. - MySQL: Same as MariaDB. (System variables).
- N1QL: N/A
-
PL/SQL:
&name
or&&name
substitution variables (and:name
bind variables - see parameters). - PostgreSQL: identifier syntax (only in PL/pgSQL).
- Redshift: N/A
-
SingleStoreDB:1
@name
(where the name consists of alphanumeric characters,_
, and$
),@`var name`
. Also@@name
for system variables. -
Snowflake:
-
$name
(using identifier syntax for name) -
$number
references the column at this place (from left to right) in the table, see here
-
-
Spark:
${name}
Like with Hive, these are substitution variables. - SQLite: N/A
- TiDB: Same as MariaDB and MySQL. System variables
-
Transact-SQL:
@name
(using identifier syntax for name) - Trino: N/A
Notes:
- Tested SingleStoreDB syntax manually. Found no full documentation of variable syntax.