在另一个数据库中从表中插入行

时间:2022-09-25 21:24:21

Is it possible to INSERT...ON DUPLICATE KEY UPDATE into a table on the current database from a table on another database?

是否可以从另一个数据库的表中INSERT ... ON DUPLICATE KEY UPDATE到当前数据库的表中?

The remote table has 3 additional columns which will need to be ignored (so can't do SELECT *).

远程表有3个额外的列,需要忽略(因此不能执行SELECT *)。

Also, is it possible to do multiple rows in one query?

此外,是否可以在一个查询中执行多行?

Thanks.

1 个解决方案

#1


If you want to do the operation between two MySQL databases on the same server, it is easy. See this thread:

如果要在同一服务器上的两个MySQL数据库之间进行操作,则很容易。看到这个帖子:

http://forums.mysql.com/read.php?61,3063,4004#msg-4004

If you want to transfer the data from a database on a different server, or if it is a different kind of database, it is more difficult and you'll probably have to use software or build some. MySQL doesn't have the database link feature that Oracle has.

如果要从不同服务器上的数据库传输数据,或者它是一种不同类型的数据库,则更加困难,您可能不得不使用软件或构建一些软件。 MySQL没有Oracle拥有的数据库链接功能。

-Jon

#1


If you want to do the operation between two MySQL databases on the same server, it is easy. See this thread:

如果要在同一服务器上的两个MySQL数据库之间进行操作,则很容易。看到这个帖子:

http://forums.mysql.com/read.php?61,3063,4004#msg-4004

If you want to transfer the data from a database on a different server, or if it is a different kind of database, it is more difficult and you'll probably have to use software or build some. MySQL doesn't have the database link feature that Oracle has.

如果要从不同服务器上的数据库传输数据,或者它是一种不同类型的数据库,则更加困难,您可能不得不使用软件或构建一些软件。 MySQL没有Oracle拥有的数据库链接功能。

-Jon