Subject | Re: [firebird-support] Check constraint |
---|---|
Author | Martijn Tonies |
Post date | 2003-09-13T16:51:19Z |
Hi Jonas,
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
http://www.upscene.com
> I got a field called field1 that should only contain values namedman/woman/child.
> How should the constraint on the table look like?If the syntax is alright - then yes. I'd rather create check constraints
>
> 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'))
> );
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
http://www.upscene.com