0
I have a client table and would like to create a support table to avoid creating many columns (address, phone, phone1, email, Email1, Email2, car plate, mother’s name, etc.).
The support table consists of customer code, field and value.
Example:
Cliente: 1
Campo: placa_do_carro
Valor: ABC-1234
What kind of data should I use in the "value" column so I can save everything? (diagram below)
I’m confused because this table can enter income that would normally be a float
and car plate that would be a varchar
.
Structure:
Table: client
cliente_cod cliente_nome cliente_email
1 José Silva [email protected]
Support table: cliente_fields
INT VARCHAR(20) ????
cliente_cod campo valor
1 placa_carro ABC-9329
1 apelido Zezinho
1 renda 5.0000
This question appeared to me in the analysis list because it was voted as not clear. Well, for me it is clear (and I voted to leave open). I just don’t think you should do what you’re proposing. What is the expected gain in having rows in a table for what should be columns in the client table? Will your system be customized (that is, the user can define "new columns" himself)? If the answer is no, I would make life easier and create columns in the same client table. :)
– Luiz Vieira
I agree with Luiz, this is not a good idea.
– Jorge B.
Did the answer solve your problem? Do you think you can accept it? If you don’t know how you do it, check out [tour]. This would help a lot to indicate that the solution was useful to you and to give an indication that there was a satisfactory solution. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero