If you’re using a relational database, you can’t use multivariate attributes, and the solution you thought really isn’t the most practical one. In relational databases, to deal with situations like this, tables are created called, in theory, weak entities.
In your case, you would have to create a third table (let’s call Veiculoinsumo - generally the name of the weak entities are formed by the name of the tables that gave rise to it), whose primary key would be formed by the primary key of the table of vehicles and the table of inputs, that is, by the field ID of the two tables.
In your queries and operations in the database, if you wanted to obtain or perform instructions on the data of this relation N:N, you would have to consider this new table created.
In a practical example, the table Veiculoinsumo would be (changed attribute name ID of the two other tables in the new table so as not to get confused):
ID_VEICULO--- ID_INSUMO
01 --- 01
01 --- 02
Whereas in the table of inputs the ID 01 corresponds to gasoline and 02 to alcohol, the above data indicate that the vehicle of ID 01 uses both gasoline and alcohol.
Using this solution, you can simulate the use of multi-valued attributes in relational databases.
Thank you for answering. Now I can understand better. But in this case, how to insert the data in the table Veiculoinsumo? In the registration page, I will have to create a registration page for vehicles and inform the ids of inputs? Like, Id_car, Model such, we inputs would be 1,2,1,1?? Pq, if it is in this logic, wouldn’t the msm who directly inform the input name? Thanks for the help.
– Rafa
Or would I have to enter data twice at msm temp in the Database? Once in the table vehicles, with the vehicle information, at the same time I enter the data 1,2,3 in the table Vehicles?
– Rafa
That would be more or less what you wrote in the second comment. What you would normally do in your case is: in vehicle registration, there would be an option (as a select that allows you to select multiple options - v. https://www.w3schools.com/html/tryit.asp?filename=html_elem_select_multiple) for the user to select the inputs that the vehicle uses. In the code that registers the data in the database, you first enter the vehicle data and, with the new ID of the registered vehicle that was generated in the database, you enter in the table Vehicle (+)
– João Victor Sierra
And the Ids of inputs selected by the user.
– João Victor Sierra