Tim*_*Tim 3 db2 enums enumeration
DB2支持枚举吗?我在网上找不到任何东西.查询不起作用:
create table prototype.test(id int not null primary key, level ENUM('upper', 'lower') not null);
Run Code Online (Sandbox Code Playgroud)
提前致谢!
您可以为此创建检查约束.
alter table prototype.test add constraint checklevel check (level in ('upper', 'lower'));
Run Code Online (Sandbox Code Playgroud)
或者您可以在create table中包含它:
create table prototype.test(
id int not null primary key,
level varchar(5) check (level in ('upper', 'lower')
);
Run Code Online (Sandbox Code Playgroud)