Can I join tables from different databases?

Speaking from SQLServer perspective, You can query different database tables using cross db queries as long as the executing account has the required privileges in the external db.
The format will be like

All the dbs used in the query should be hosted in the same instance

Otherwise you would to setup a linked server connection to the other instance before you include the tables in the query