Enums DB2支持枚举吗?
DB2支持枚举吗?我没有在网上找到任何东西。 查询不起作用:Enums DB2支持枚举吗?,enums,db2,enumeration,Enums,Db2,Enumeration,DB2支持枚举吗?我没有在网上找到任何东西。 查询不起作用: create table prototype.test(id int not null primary key, level ENUM('upper', 'lower') not null); 提前谢谢 否DB2不支持枚举。我知道有一些数据库支持Enum是MySql和Postgresql,但DB2肯定不支持它。您可以为此创建一个检查约束 alter table prototype.test add constraint checkl
create table prototype.test(id int not null primary key, level ENUM('upper', 'lower') not null);
提前谢谢 否DB2不支持枚举。我知道有一些数据库支持Enum是MySql和Postgresql,但DB2肯定不支持它。您可以为此创建一个检查约束
alter table prototype.test add constraint checklevel check (level in ('upper', 'lower'));
也可以将其包含在创建表中:
create table prototype.test(
id int not null primary key,
level varchar(5) check (level in ('upper', 'lower')
);