Project: one database or 2 databases

A Quick check with ChatGPT brought up a hint that might be interesting:


In MySQL, you can join tables from different databases by specifying the full database name before the table name. Here's an example of how to do this:

Suppose you have two databases, `database1` and `database2`, and you want to join tables from these two databases:

```sql
SELECT
a.column1,
b.column2
FROM
database1.table1 a
JOIN
database2.table2 b
ON
a.common_column = b.common_column;
```

In this example:
- `database1.table1` is the table from the first database.
- `database2.table2` is the table from the second database.
- `a` and `b` are aliases for the respective tables.
- `common_column` is the column that both tables share and which is used to perform the join.

This way, you can easily join tables from different databases in MySQL.
 
Ha ! It another question: if the data table source is splitted into several user DBs - if to get the pivot table, the ids are non-unique
 
Ha ! It another question: if the data table source is splitted into several user DBs - if to get the pivot table, the ids are non-unique
If you have bad DB design you should pay big price in development time. Sometime you have no choice, but use translation tables.
 
Back
Top