I have a table with machines data:
machines
----------
id
owner_id
// other data
We also have official machine data that comes from Germany and France. Both have the same information:
# Machine data (for german and french machines)
- machine_id: to tie to machines table
- record_number: unique number for each machine, different format for each country
- machine_name: the name of the machine
- market_id: id associated with the machine market, different format for each country
Market data (also for german and french machines)
- market_id: machine market id, different format for each country
- market_name: name of the market
- specific country information that is different for France and Germany
At first I though that the relational schema would be like the following:
machines
---------
machine_id
owner_id
// other data
machine_information
machine_id
record_number
country (German or France)
machine_name
market_id
france_markets
id
market_name
// France specific column data
german_markets
id
market_name
// German specific column data
But this can make it very difficult to filter data, because when getting a machine information, we do not know which market table we have to join.
I also though about splitting the machines_information into 2, one for each country
machines
---------
machine_id
owner_id
// other data
france_machine_information
machine_id
record_number
machine_name
market_id
german_machine_information
machine_id
record_number
machine_name
market_id
france_market
id
market_name
// France specific column data
german_market
id
market_name
// German specific column data
But this also has the same problem because when getting the machine information, we do not know which machine information table we have to join.
Is there a good solution for that kind of design?
Thank you!