Subject Re: [firebird-support] Check constraint
Author Martijn Tonies
Hi Jonas,

> I got a field called field1 that should only contain values named
> How should the constraint on the table look like?
> is this correct?
> create table passagerare
> (
> personnr int not null,
> fornamn varchar(50) not null,
> efternamn varchar(50) not null,
> typ varchar(10) not null,
> passning char(1) not null,
> primary key(personnr) ,
> CHECK (typ IN ('man', 'woman', 'child')) ,
> CHECK (passning IN ('J', 'N'))
> );

If the syntax is alright - then yes. I'd rather create check constraints
after I've created the table.

Anyway, if "woman" and "child" are the largest values (in length)
then why is "typ" a varchar(10) and not a char(5) or varchar(5)?

With regards,

Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions