Виртуальная песочница (тм)

Thursday, March 5, 2009

JavaDB: Check constraints


create table FREQUENCIES (
NAME varchar(20) check (NAME in ('daily', 'weekly', 'monthly', 'yearly'))
);
insert into FREQUENCIES (NAME) values ('daily'), ('monthly');
select * from FREQUENCIES;

However something like

insert into FREQUENCIES (NAME) values ('hourly');

will lead to an error:

Error code -1, SQL state 23513: The check constraint 'SQL090305033046840' was violated while performing an INSERT or UPDATE on table 'ADMIN.FREQUENCIES'.
Line 1, column 1

See also "JavaDB 10.1.3: ALTER TABLE statement".

No comments: