插入符号 (^) 在 SQL 查询中有什么作用? [英] What does a caret (^) do in a SQL query?
本文介绍了插入符号 (^) 在 SQL 查询中有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下 SQL Server 查询中插入符号 (^) 的作用是什么?
SELECT 1^2, 1^3;
给出结果:
3 2
我在找到 SQUARE() 函数之前就遇到了这个.
解决方案
插入符号 (^) 转换为 XOR 运算符,它是按位异或".在简单的英语中,它的意思是要么,但不是两者".这是它的作用:
decimal 1 = 二进制 001 十进制 1 = 二进制 001异或异或十进制 2 = 二进制 010 十进制 3 = 二进制 011= =十进制 3 = 二进制 011 十进制 2 = 二进制 010
有关 按位运算的 MSDN 页面上的更多信息.>
What is the caret (^) doing in the following SQL Server query?
SELECT 1^2, 1^3;
which gives the results:
3 2
I came across this before I found the SQUARE() function.
解决方案
The caret (^) translates to the XOR operator, which is a "bitwise exclusive or". In plain english it means "either, but not both". Here's what it does:
decimal 1 = binary 001 decimal 1 = binary 001
XOR XOR
decimal 2 = binary 010 decimal 3 = binary 011
= =
decimal 3 = binary 011 decimal 2 = binary 010
More info on the MSDN page for bitwise operations.
这篇关于插入符号 (^) 在 SQL 查询中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文