Subject Re: [ib-support] check syntax
Author Martijn Tonies
Hi,

>>create a constraint that verifies that the value of a column exists
>>in a second table,
>
>I am afraid I don't know how to do this ... <blushing>


Table PARENT

ParentID Integer not null primary key

Table CHILD

ChildID Integer not null primary key // to identify child
ParentID Integer

ALTER TABLE CHILD
ADD CONSTRAINT FOREIGN KEY (ParentID)
REFERENCES PARENT (ParentID)

We now have a CHILD table with either:

1) no parents (NULL in the column ParentID)
2) a parent as available in table PARENT


Download the Language Reference and take a look at it.

Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."