Query Help Please
I have been battling with a query that will assist me .
My previuos thread http://www.sitepoint.com/forums/show...=1#post1647117 under the php section has helped abit as well.
What I have is a html form with a set of health symptoms,that will be inserted into a database using implode() in php, I will extract the data using explode() in php.
Now if I take a condition like diabetes, when someone fills in a assessment , I want to know what other symptons were filled in together with diabetes, and how often.
Basically I want to be able to extract the most common symptons that were selected together with diabetes.
See my post above if unclear.
Please help me , I need this for my college project.
well, i hate to break it to you, but while implode and explode are wonderful programming functions, storing more than one value in a column is very poor database design practice
design your database table to have one symptom per row -- the key of this row will be what determines multiplicity of symptoms
read this article: Fundamentals of Relational Database Design
I have to agree, you need to break up those column entries before you do anything else, this should make it much easier to mine the statistics you want out of your DB.
Thanks for the reply,
If i go ahead and break it up, will I not have a table that is not normalised.
I buy 4 products, using an array I would have :-
Now if I have each item on a single row I will have
Am I correct in saying this, will this not result a databse that is not normalised.
I am only asking, I am one gal that is still learning,I donot know much about these stuff.
you are correct, this will not result a databse that is not normalised
the example with the 4 rows IS normalized
all 4 values in a single row is NOT normalized
you always want to go for the normalized solution
here's another example: The effect of normalization on query simplicity (site registration may be required, but it's free)