Cross-database usage examples in single-schema systems
In the following examples, the system has two databases, PROD and DEV, and each database has a table that is named EMP. While connected to the DEV database, you can retrieve all rows from the table EMP using the following command.
DEV.DBUSER(DBUSER)=> SELECT * FROM emp;
While connected to DEV, if you want to select rows from the EMP table in PROD, you can use the database.schema.object name format to identify the table, for example:
DEV.DBUSER(DBUSER)=>SELECT * FROM prod.dbuser.emp;
You can use cross-database INSERT, UPDATE, or DELETE statements to change a table in a different, remote, database. For example:
DEV.DBUSER(DBUSER)=>INSERT INTO prod..emp SELECT * FROM newusers;