当前位置:网站首页>金仓数据库 KingbaseES SQL 语言参考手册 (3.1.1.6. 布尔类型、3.1.1.7. 位串类型)
金仓数据库 KingbaseES SQL 语言参考手册 (3.1.1.6. 布尔类型、3.1.1.7. 位串类型)
2022-07-16 03:05:00 【沉舟侧畔千帆过_】
3.1.1.6. 布尔类型
语法:BOOLEAN
KingbaseES 提供标准的 SQL 类型 BOOLEAN。 BOOLEAN取值为“true(真)”、“false(假)”和第三种状态“unknown(未知)”,未知状态由 SQL 空值表示。
数据类型
描述
BOOLEAN
表示真、假的数据类型。1字节存储。
3.1.1.7. 位串类型
位串就是一串 1 和 0 的串。
3.1.1.7.1. BIT类型
语法 :BIT[(n)]
n是正整数,数据必须准确匹配长度 “n“,如果存储短些或者长一些的位串都会报错。n缺省,默认为1。
3.1.1.7.2. BIT VAYRING类型
语法 :BIT VAYRING(n)
变长位串,最长为n,n是正整数。如果存储超过n则报错。n缺省,表示该类型没有长度限制。
注意
如果我们显式地把一个位串值转换成bit(n), 那么它的右边将被截断或者在右边补齐零,直到刚好``n``位, 而且不会抛出任何错误。类似地,如果我们显式地把一个位串数值转换成bit varying(n),如果它超过了``n``位, 那么它的右边将被截断。
请参考 位串常量 获取有关位串常量的语法的信息。还有一些位逻辑操作符和串操作函数可用,见 位串函数和操作符 。
例10-1.使用位串类型
CREATE TABLE test (a BIT(3), b BIT VARYING(5)); INSERT INTO test VALUES (B'101', B'00'); INSERT INTO test VALUES (B'10', B'101'); ERROR: bit string length 2 does not match type bit(3) INSERT INTO test VALUES (B'10'::bit(3), B'101'); SELECT * FROM test; a | b -----+----- 101 | 00 100 | 101
一个位串值对于每8位的组需要一个字节,外加总共5个或8个字节,这取决于串的长度(但是长值可能被压缩或者移到线外,如 字符类型 中对字符串的解释一样)。
边栏推荐
- Word -- set tab width
- Share the operation steps of postman connecting to MySQL database from the beginning of installation
- hcip第六天笔记
- [golang | GRC] GRC bidirectional streaming two-way flow practice
- hcip静态综合复习实验
- 自动追番工具BGmi
- 【编程强训4】计算糖果+进制转换
- Hyperspace travel solution
- 第十九周作业
- 5g applications are accelerated, and cool Lehman VR live broadcast is born at the right time.
猜你喜欢

Constants and object freezing of typescript
![[golang | GRC] GRC client streaming client streaming practice](/img/03/81972027ebaa1f5f20b61e35b12ea1.png)
[golang | GRC] GRC client streaming client streaming practice

hcip第一天学习--复习hcia(静态)

3 minutes to understand the three waiting methods of Web Automation

分享一下Postman连接MySQL数据库的操作步骤,从安装开始讲起

MySQL Basic - add and Advanced Query

解决pycharm无法输入中文的方法:

【Golang | gRPC】gRPC-Client Streaming客户端流实战

hcip第五天筆記

5g applications are accelerated, and cool Lehman VR live broadcast is born at the right time.
随机推荐
ES6 browser support and running environment support detection and ES6 transcoding Es5
【Golang | gRPC】gRPC-Server Streaming服务端流实战
ES6浏览器支持及运行环境支持检测及ES6转码ES5
一文速学-PySpark数据分析基础:Spark本地环境部署搭建
MySQL foundation - add, delete, check and modify (Foundation)
【编程强训9】走方格的方案数(递归)+另类加法(位运算)
Why is UDP header only 8 bytes
Motion capture assists China Electric Power Research Institute in establishing a side cloud collaborative power independent inspection system
Do you need to find a platform to do VR panorama? What help can panoramic platform bring?
做测试/开发程序员的动力来自哪里?怎样坚持下去呢......
自动追番工具BGmi
IIC读写EEPROM
RealSense D435——相机内参获取
How to systematically and efficiently learn the entry-level software testing and find the work of software testing?
Still reading logs on the command line? Use kibana, visual log analysis yyds~
【编程强训4】计算糖果+进制转换
hcip第一天学习--复习hcia(静态)
[golang | GRP] GRP service using tls/ssl authentication
Makefile 编译多个目标文件
金仓数据库 KingbaseES SQL 语言参考手册 (3.1.1.8. 几何类型)