I have the following table:
CREATE TABLE child( id INTEGER PRIMARY KEY, parent_id INTEGER, description TEXT);
How do I add a forei
You can add the constraint if you alter table and add the column that uses the constraint.
First, create table without the parent_id:
CREATE TABLE child( id INTEGER PRIMARY KEY, description TEXT);
Then, alter table:
ALTER TABLE child ADD COLUMN parent_id INTEGER REFERENCES parent(id);