C
ccc31807
I'm building a database app (in Perl) and have a database question.
Ordinarily, when you have a many to many relationship, such as patient/
diagnosis, you deal with it by having a conversion table, where (for
example) patients are not unique, diagnoses are not unique, but a
patient/diagnosis combination is unique.
I my app, I have this situation, but this approach seems to cumbersome
and I quite frankly think it will take too much of an effort for the
little bit of utility that I need, because I don't need to access
diagnoses, just display them, and only display them on infrequent
occasions. I've been using Postgres and have been spoiled by the array
datatype that PG has. If I were using PG, I'd use the array datatype.
(One problem is that the diagnoses are free form and it's just too
difficult to shoe-horn a multiplicity of diagnoses into a manageable
number.)
My client insists on using MySQL. I'm about to create a table, which
has a column 'diagnoses' and a datatype of text. I will append values
to this colum in a CSV format, such as (e.g.) "broken finger|headache|
sprained ankle|influenza". I can then access this cell as a string,
split on the pipe, and manipulate the resulting list as an array.
Has anyone done this? Does it work? What are the disadvantages?
Comments in general?
Thanks, CC.
Ordinarily, when you have a many to many relationship, such as patient/
diagnosis, you deal with it by having a conversion table, where (for
example) patients are not unique, diagnoses are not unique, but a
patient/diagnosis combination is unique.
I my app, I have this situation, but this approach seems to cumbersome
and I quite frankly think it will take too much of an effort for the
little bit of utility that I need, because I don't need to access
diagnoses, just display them, and only display them on infrequent
occasions. I've been using Postgres and have been spoiled by the array
datatype that PG has. If I were using PG, I'd use the array datatype.
(One problem is that the diagnoses are free form and it's just too
difficult to shoe-horn a multiplicity of diagnoses into a manageable
number.)
My client insists on using MySQL. I'm about to create a table, which
has a column 'diagnoses' and a datatype of text. I will append values
to this colum in a CSV format, such as (e.g.) "broken finger|headache|
sprained ankle|influenza". I can then access this cell as a string,
split on the pipe, and manipulate the resulting list as an array.
Has anyone done this? Does it work? What are the disadvantages?
Comments in general?
Thanks, CC.