如何将一个数据库中的 table 的特定列转移到另一个数据库中?

How to transfer specific columns of a table in one database into another database?

我正在为 PostgreSQL 使用 pgAdmin 4。我有两个数据库 AB,每个数据库都有一个名为 records 的 table。在数据库 A、table records 中有 3 列 person_idshop_freqtime,大约有 1000 行。而在数据库 B 中,table records 有 4 列 person_idshop_freqstart_timeend_time,并且是空的。

我想将列person_idshop_freq的数据从数据库A传输到数据库B中它们对应的列,然后传输列[=20] =] 数据库 A 到列 start_time,并将随机数据(例如 start time 之后大约 1 到 2 个月)传递到列 end_time.

如何在 pgAdmin 本身中以简单干净的方式完成这样的事情?

您可以使用 COPY 语句将数据导出到数据库服务器上的文件,并使用 COPY 和列名将它们加载到其他数据库中。

要填充缺失的列,运行 导入后的 UPDATE 语句。