1
I am studying Mysql using Mysql Workbrench to create a diagram of my database and the following situation arose: Imagine that I have the table_A and the table_intensity, where :
Structure of table: id, name, intensity_1, intensity_2
Structure of the table_intensity: id_intensity, description_intensity
My question is: I would like the intensity_1 and intensity_2 fields of the table_A to receive the intensity id_intensity of the table, in a cardinality ratio of 1 to 1. That is, create two foreign keys of the same table. Is that possible? That would be the right way?
I’ll try to create a more 'real' scenario'.
Imagine a scenario in the field of oceanography, where the table_A , in addition to the primary key, also needs to keep the direction of the wind (dir_wind) and the direction of the undulation (dir_ondulacao). Knowing that the table winds (id_wind, desc_wind) has all possible directions, and both fields dir_wind and dir_wave are also winds, is it possible that they saved the id_wind, for future I rescue the dsc_wind from the table wind from them?? ie, would be the fields dir_vento and dir_ondulacao foreign keys of the table?
They kind of wanted the idea?
Wouldn’t it be better to describe a little where you’re going with this?
– Marconi
there’s nothing wrong with the way you’re doing, just because it’s a different case people think you’re wrong, I’ve posted the answer just run the script there.
– SneepS NinjA