sqlÖÐ^ÊÇʲôÒâ˼
sqlÖеÄ^·ûºÅ´ú±í°´Î»Òì»òÔËË㣬ÓÃÓÚ½ÏÁ¿Á½¸ö¶þ½øÖÆλ²¢·µ»ØÒ»¸öÐÂλ¡£¹æÔòΪ£º0 ^ 0 = 0£¬0 ^ 1 = 1£¬1 ^ 0 = 1£¬1 ^ 1 = 0¡£ÓÃ;°üÀ¨£ºÉèÖûò×÷·Ï±ê¼Ç룬½ÏÁ¿Öµ£¬ÒÔ¼°¼òÆӵļÓÃÜÏ¢ÕùÃÜ¡£
SQL ÖÐ ^ µÄ¼ÄÒå
SQL ÖÐµÄ ^ ·ûºÅÌåÏÖ°´Î»Òì»òÔËË㣬ÓÃÓÚ½«Á½¸ö루0 »ò 1£©Ïà½ÏÁ¿£¬²¢·µ»ØÒ»¸öÐÂλ¡£
ÔËËã¹æÔò£º
0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0
ÓÃ;£º
°´Î»Òì»òÔËËã³£ÓÃÓÚ£º
ÉèÖûò×÷·Ï±ê¼Ç£ºÍ¨¹ý½«ÁÐÓë 1 ÏàÒì»ò£¬¿ÉÒÔÉèÖûò×÷·Ï¸ÃÁÐÖеıê¼Çλ¡£
½ÏÁ¿Öµ£ºÍ¨¹ý½«Á½¸öÁÐÏàÒì»ò£¬¿ÉÒÔÈ·¶¨ËüÃÇÊÇ·ñÏàͬ¡£Ð§¹ûΪ 0 ÌåÏÖÏàͬ£¬·Ç 0 ÌåÏÖ²î±ð¡£
¼ÓÃÜ£ºÒì»òÔËËã¿ÉÒÔÓÃÓÚ¼òÆӵļÓÃÜÏ¢ÕùÃÜ¡£
ʾÀý£º
-- ÉèÖñê¼Çλ UPDATE users SET is_active = is_active ^ 1 -- ½ÏÁ¿Öµ SELECT CASE WHEN field1 ^ field2 = 0 THEN 'Ïàͬ' ELSE '²î±ð' END FROM table -- ¼ÓÃÜÊý¾Ý SELECT CAST(CAST(data AS BINARY) ^ 0x1234567890 AS TEXT) FROM secret_table
µÇ¼ºó¸´ÖÆ
×¢ÖØ£º
°´Î»Òì»òÔËËãÖ»ÊÊÓÃÓÚ¶þ½øÖÆÖµ»òλÑÚÂë¡£ÆäËûÊý¾ÝÀàÐÍ£¨ÈçÕûÊý»ò×Ö·û´®£©½«±»×Ô¶¯×ª»»Îª¶þ½øÖÆÖµ¾ÙÐÐÔËËã¡£
ÒÔÉϾÍÊÇsqlÖÐ^ÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡