SQL语句中的“set 0”有什么作用?
发布时间:2020-12-12 07:03:55 所属栏目:MsSql教程 来源:网络整理
导读:我对这个SQL语句的含义感到困惑: SELECT exhibitor_categories+0 from exhibitor_registry 什么是Exhibitor_categories 0?它返回返回的每一行的数字. Exhibitor_categories定义为: set('contemporary','classical impression / transitional','outdoor','h
我对这个SQL语句的含义感到困惑:
SELECT exhibitor_categories+0 from exhibitor_registry 什么是Exhibitor_categories 0?它返回返回的每一行的数字. Exhibitor_categories定义为: set('contemporary','classical impression / transitional','outdoor','home accessories') 谢谢你的时间 :) 解决方法它隐含地将设定值转换为INTEGER.集合被视为位图,因此第一个值设置位0,第二个值设置位1等. mysql> CREATE TABLE exhibitor_registry(exhibitor_categories set('contemporary','home accessories') NOT NULL); Query OK,0 rows affected (0.08 sec) mysql> INSERT -> INTO exhibitor_registry -> VALUES ('contemporary,classical impression / transitional,outdoor'); Query OK,1 row affected (0.03 sec) mysql> SELECT exhibitor_categories -> FROM exhibitor_registry; +----------------------------------------------------------+ | exhibitor_categories | +----------------------------------------------------------+ | contemporary,outdoor | +----------------------------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT exhibitor_categories + 0 -> FROM exhibitor_registry; +--------------------------+ | exhibitor_categories + 0 | +--------------------------+ | 7 | +--------------------------+ 1 row in set (0.00 sec) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |