[postgresql] Table creation statement: add a column type_id to table A, and type_id is the id field of the foreign key associated type table;

Create table statement

need:

Add a column type_id to table A, and type_id is the id field of the foreign key associated type table;

sql:

-- 添加 chip_type_id 列
ALTER TABLE table_a ADD COLUMN type_id INTEGER;

-- 添加外键约束
ALTER TABLE table_a ADD CONSTRAINT fk_chip_type_id
  FOREIGN KEY (chip_type_id) REFERENCES type(id);

Guess you like

Origin blog.csdn.net/qq_41604569/article/details/130317703