Subject | Check constraint |
---|---|
Author | Datatal AB - Gauffin, Jonas |
Post date | 2003-09-13T16:25:42Z |
I got a field called field1 that should only contain values named man/woman/child.
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'))
);
[Non-text portions of this message have been removed]
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'))
);
[Non-text portions of this message have been removed]