Subject | Re: [firebird-support] Foreign constraints |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-06-17T12:03:04Z |
Hi Tim,
create table Stages (
stage_id DREC_ID,
leerling_id DREC_ID,
bedrijf_id DREC_ID,
afdeling_id DREC_ID,
soortwerkplek DSOORTWERKPLEK,
kontaktpersoon DPERSOON,
kontaktpers_mv DMV,
stagebegeleider DPERSOON,
stagebeg_mv DMV,
startdatum date not null,
einddatum date not null,
opmerking DOPMERKING,
constraint pk_Stages primary key ( stage_id ),
constraint fk_Stage_Leerling foreign key ( leerling_id )
references Leerlingen ( leerling_id ) on update cascade,
constraint fk_Stage_Bedrijf foreign key ( bedrijf_id )
references Bedrijven_Globaal ( bedrijf_id ) on update cascade,
constraint fk_Stage_Afdeling foreign key ( afdeling_id )
references Afdelingen ( afdeling_id ) on update cascade
);
Greetings,
Paul Vinkenoog
> Now, is there any way of naming foreign key constraints when youHere's an example I'm just having in front of me. Self-explanatory:
> create them? It says so in the documentation, (under column
> constraints) but I can't figure it out. It makes it easier for the
> user to have some message that would reflect, say, the column name
> and table name rather than "INTEG_13" and the table name.
create table Stages (
stage_id DREC_ID,
leerling_id DREC_ID,
bedrijf_id DREC_ID,
afdeling_id DREC_ID,
soortwerkplek DSOORTWERKPLEK,
kontaktpersoon DPERSOON,
kontaktpers_mv DMV,
stagebegeleider DPERSOON,
stagebeg_mv DMV,
startdatum date not null,
einddatum date not null,
opmerking DOPMERKING,
constraint pk_Stages primary key ( stage_id ),
constraint fk_Stage_Leerling foreign key ( leerling_id )
references Leerlingen ( leerling_id ) on update cascade,
constraint fk_Stage_Bedrijf foreign key ( bedrijf_id )
references Bedrijven_Globaal ( bedrijf_id ) on update cascade,
constraint fk_Stage_Afdeling foreign key ( afdeling_id )
references Afdelingen ( afdeling_id ) on update cascade
);
Greetings,
Paul Vinkenoog