I am taking a Cousera course talking about SQL and there is one line of code I cannot understand.
我正在上一门关于SQL的课程,有一行代码我听不懂。
What does it mean by 'hex(name || age)'? I know it turns the string into hexadecimal format using the hex() function, but what does 'name || age' do? I cannot find any document about the '||' operator.
“十六进制”是什么意思?我知道它使用十六进制()函数将字符串转换成十六进制格式,但是'name || age'做什么?我找不到任何关于“||”操作符的文件。
3 个解决方案
#1
4
||
is the SQLite concatenation operator. So hex(name || age)
will pass a concatenated string of name
and age
into the hex()
function.
||是SQLite连接操作符。因此,十六进制(名称|| age)将把名称和年龄的串联字符串传递给十六进制()函数。
From the SQLite documentation:
SQLite的文档:
The hex() function interprets its argument as a BLOB and returns a string which is the upper-case hexadecimal rendering of the content of that blob.
函数的作用是:将参数解释为BLOB并返回一个字符串,该字符串是该BLOB内容的大小写十六进制渲染。
#2
1
The documentation says:
文档表示:
The || operator is "concatenate" - it joins together the two strings of its operands.
||操作符是“连接”——它将其操作数的两个字符串连接在一起。
#3
0
|| is the pipe or concat operator which would concatenate two strings E.g. if name is PREETI and age is 25 'name || age' would be PREETI25
||是连接两个字符串的管道或concat操作符,例如,如果名称是PREETI,年龄是25 'name || age是PREETI25
#1
4
||
is the SQLite concatenation operator. So hex(name || age)
will pass a concatenated string of name
and age
into the hex()
function.
||是SQLite连接操作符。因此,十六进制(名称|| age)将把名称和年龄的串联字符串传递给十六进制()函数。
From the SQLite documentation:
SQLite的文档:
The hex() function interprets its argument as a BLOB and returns a string which is the upper-case hexadecimal rendering of the content of that blob.
函数的作用是:将参数解释为BLOB并返回一个字符串,该字符串是该BLOB内容的大小写十六进制渲染。
#2
1
The documentation says:
文档表示:
The || operator is "concatenate" - it joins together the two strings of its operands.
||操作符是“连接”——它将其操作数的两个字符串连接在一起。
#3
0
|| is the pipe or concat operator which would concatenate two strings E.g. if name is PREETI and age is 25 'name || age' would be PREETI25
||是连接两个字符串的管道或concat操作符,例如,如果名称是PREETI,年龄是25 'name || age是PREETI25