alter table create foreign key postgre code example
Example 1: create table postgresql foreign key
CREATE TABLE so_items (
so_id INTEGER,
...
FOREIGN KEY (so_id) REFERENCES so_headers (id)
);
Example 2: postgre alter table foreign key
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses (address) MATCH FULL;