Hello,
Don’t believe you have thought of how Base works.
You create a Base file. While creating this file you establish what database you are connecting to. If you connect to an embedded database, you are stuck with that connection for that Base File.
If you make the connection other than an embedded database, you can actually change that connection to a different database and even a different type such as MySQL to PostgreSQL. It is not recommended but can be done. Now even though you can do this, you are still only connected to one database.
Although it would need much consideration as to ALL the implications of doing what you ask, you may have one non-embedded database and connection locally for off-line processing and another to connect to the main server.
Now, again, you are typically not going to use SQL to transfer the data. Your solution (depending upon databases used) may be a third party utility to pump data from one table/database to another. But even this will be tricky as to what type of data/relations there may be.
There is too much to consider to discuss here and that further discussion is not even a topic for this forum as it does no concern LO.
As for SQL working with two databases, SQL depends mostly upon table names, field names and functions. If all are the same SQL should work.