-1
我试图创建一个只有CHAR(9)或EMPTY VALUE(空字符串'')的属性(它是主键)的表,如下所示:在CHAR中插入空值,SQL
create table person(
number CHAR (9) CHECK (number SIMILAR TO '[0-9]{2}-[0-9]{6}' OR number LIKE '_%')
);
而且我有相似试过它两个条件
create table person(
number CHAR (9) CHECK (number SIMILAR TO '[0-9]{2}-[0-9]{6}' OR number SIMILAR TO '_%')
);
,但两种方式都不能正常工作
不应该是'OR trim(col)='''? –
ohhh你的权利..因为破折号的字符(9)。我用数字作为CHAR,以便我可以应用约束来获得像这样的格式(xx-xxxxxx),我的意思是空值是这样的('')或空字符串,因为他们称之为 – Sam
谢谢它的工作原理 – Sam