DB2 是否支持枚举?
Does DB2 support enums?
DB2 支持枚举吗?我真的没有在网上找到任何东西。
查询无效:
create table prototype.test(id int not null primary key, level ENUM('upper', 'lower') not null);
提前致谢!
否 DB2 不支持 ENUMS。我知道有一些数据库支持 Enums MySql 和 Postgresql,但 DB2 肯定 不 支持它。
您可以为此创建一个检查约束。
alter table prototype.test add constraint checklevel check (level in ('upper', 'lower'));
或者您可以将其包含在创建 table:
create table prototype.test(
id int not null primary key,
level varchar(5) check (level in ('upper', 'lower')
);
DB2 支持枚举吗?我真的没有在网上找到任何东西。 查询无效:
create table prototype.test(id int not null primary key, level ENUM('upper', 'lower') not null);
提前致谢!
否 DB2 不支持 ENUMS。我知道有一些数据库支持 Enums MySql 和 Postgresql,但 DB2 肯定 不 支持它。
您可以为此创建一个检查约束。
alter table prototype.test add constraint checklevel check (level in ('upper', 'lower'));
或者您可以将其包含在创建 table:
create table prototype.test(
id int not null primary key,
level varchar(5) check (level in ('upper', 'lower')
);