CREATE TABLE product_a
(
id SMALLINT AUTO_INCREMENT,
name_a VARCHAR(10),
code_a INTEGER,
PRIMARY KEY (id)
);
CREATE TABLE product_b
(
id SMALLINT AUTO_INCREMENT,
name_b VARCHAR(10),
code_b INTEGER,
PRIMARY KEY (id)
);
INSERT INTO product_b VALUES (null, 'prod_b_3', 300);
ALTER TABLE product_a ADD name_b VARCHAR(10);
UPDATE product_a AS pa
SET pa.name_b = (SELECT pb.name_b FROM product_b AS pb WHERE pb.code_b = pa.code_a);