In MySQL
, I have two different databases -- let's call them A
and B
.
Database A
resides on server server1
, while database B
resides on server server2
.
Both servers {A
, B
} are physically close to each other, but are on different machines and have different connection parameters (different username, different password etc).
In such a case, is it possible to perform a join between a table that is in database A
, to a table that is in database B
?
If so, how do I go about it, programatically, in python
? (I am using python
's MySQLDB
to separately interact with each one of the databases).
SQL Server allows you to join tables from different databases as long as those databases are on the same server. The join syntax is the same; the only difference is that you must fully qualify table names.
Yes, assuming the account has appropriate permissions you can use: SELECT <...> FROM A. table1 t1 JOIN B.
Try to use FEDERATED Storage Engine.
Workaround: it is possible to use another DBMS to retrieve data between two databases, for example you could do it using linked servers in MS SQL Server (see sp_addlinkedserver stored procedure). From the documentation:
A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With