KingbaseESV7 空值占位属性

本文介绍了如何在PostgreSQL中使用两种方法创建带有空值占位属性的表:一是通过模板表template_1,二是直接创建并设置alloc_space_for_null属性。通过查询sys_class中的reloptions属性来验证表是否带有空值占位特性。
摘要由CSDN通过智能技术生成

Q: 如何创建空值占位属性表

A:

创建方式

1、带有空值占位属性的模板表

a)create  table  template_1 (a int,b text) with (template_alloc_space_for_null = true);

--创建一个名字为 template_1的模板表。该表具有空值占位模板属性,凡是参照该表创建的表,都会自动带有空值占位属性。

b)create table sub_table as select * from template_1;

    --参照模板表创建一个名为 sub_table的表。

c)select relname,reloptions from sys_class where relname in ('TEMPLATE_1','SUB_TABLE');

    查询两张表的属性(reloptions),结果会显示 template_1表的reloptions为 template_alloc_space_for_null,sub_table表的reloptions为 alloc_space_for_null。

2、只带有空值占位属性的表

a)create table alloc_table(c1 int,c2 text) with (alloc_space_for_null=true);

b)select relname,reloptions  from sys_class where relname='ALLOC_TABLE';

    结果显示 alloc_table表的reloptions属性为 alloc_space_for_null.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值