且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 Mysql 中的另一个表中将列添加到表中?

更新时间:2023-12-01 09:34:58

先在table1中添加Age列

First add Age column in table1

ALTER TABLE table1 ADD COLUMN Age TINYINT UNSIGNED DEFAULT 0;

然后使用打击查询更新该列

then update that column using blow query

UPDATE table1 t1
INNER JOIN Tabel2 t2 ON t1.id = t2.id 
SET t1.age = t2.age;