Just like any other foreign key.
This example will work:
CREATE TABLE PERSON(
ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT
NULL PRIMARY KEY,
OTHER_PERSON_ID INTEGER):
ALTER TABLE PERSON ADD CONSTRAINT PERSON_FK1 KEY(OTHER_PERSON_ID)
REFERENCES PERSON(ID) ;
-----Original Message-----
From: Amir Michail [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 28, 2007 10:57 AM
To: Derby Discussion
Subject: adding foreign key that refers to primary key of same table
Hi,
How do you add a foreign key to an existing table that refers to the
primary key of that table?
Amir