During our last weekly meeting, a person that has no background experience in Database Administration brought up this question:
"Would there be a scenario that justifies storing data in-line (string) instead of several lines?"
Let us assume a table called countryStates
where we want to store the states of a country; I'll use USA for this example and will not list all the States for the sake of laziness.
There we would have two columns; one called Country
and the other called States
. As discussed here, and proposed by @srutzky's answer, the PK
will be the code defined by ISO 3166-1 alpha-3.
Our table would look like this:
+---------+-----------------------+-------------------------------------------------------+
| Country | States | StateName |
+---------+-----------------------+-------------------------------------------------------+
| USA | AL, CA, FL,OH, NY, WY | Alabama, California, Florida, Ohio, New York, Wyoming |
+---------+-----------------------+-------------------------------------------------------+
When asking this same question to a friend developer, he said that from the data traffic size point of view, this might be useful, but not if we need to manipulate this data. In this case there would have to be an intelligence on the application code which could transform this string in a list (let's say that the software that has access to this table needs to create a combo box).
We concluded that this model is not very useful, but I got suspicious that there might be a way to make this useful.
What I'd like to ask is if any of you already saw, heard or done something like this in a way that really works.
a;b;c
, use the front end to parse your string you then geta
,b
,c
and carry on execution doing something with them, maybe?. Feel it might suit some sort of specific need in that fashion... On second thought, no. You could always store IDs, Join your tables and create a concatenated string than can send content to the FE...