In the previous recipe, we saw how to connect to a single database which was an Access
file named Sample - Coffee Chain.mdb
or Sample - CoffeeChain (Use instead of MS Access).xlsx
and join multiple tables within it. There could also be instances where the data resides in multiple data sources. For example, the transactional sales data could be getting captured in, let's say, a SQL database and the yearly/monthly budgets are defined in Excel. In this situation, Excel is one data source and SQL is another data source. In order to see whether the targets were met or not, we would be required to get data from both Excel as well as SQL.
Cross-database Joins help us make Joins across multiple databases across a single data source, or multiple databases across multiple data sources.
Let us take a look at how we can do a cross-database join in the following recipe.