Skip to main content

Context Functions

Context Functions in SQL.

FunctionDescriptionExampleResult
CONNECTION_ID()Return the connection id for the connection.CONNECTION_ID()9b16ca73-e393-43bb-a77b-fa546e1b7b69
CURRENT_USER()Returns the user name and host name combination for the account that the server used to authenticate the current client. This account determines your access privileges. The return value is a string in the utf8 character set.CURRENT_USER()'root'@'127.0.0.1'
DATABASE()Returns the name of the currently selected database. If no database is selected, then this function returns default.DATABASE()default
VERSION()Return the current version information of DatabendQuery.VERSION()DatabendQuery v-0.1.0-0f9ec31-simd(1.56.0-nightly-2021-08-10T15:25:36.875868571+00:00)
LAST_QUERY_ID(index)Return the last query id of query in current session, index can be (-1, 1, 1+2)..., out of range index will return empty stringLAST_QUERY_ID(-1)5334c6a9-3628-4579-82d1-89302ecf1d42