postgresql create table with foreign key 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: psql create table foreign keys
# id_user is the primary key of the table users:
create table lists(
id_list serial not null primary key,
id_user int references users(id_user),
is_temp int
);