Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: MySQL Answer

by screamingeagle (Curate)
on Jul 19, 2002 at 17:02 UTC ( #183312=note: print w/replies, xml ) Need Help??

in reply to MySQL Answer

ummm...there are better ways to store the data .The database structure you currently have violates the First Normal Form of database design by saving category and subcategory in a single field. Here's a nice article about database normalization (Normalization)
I would recommend having a Category Table and a Subcategory table , the link between the both of them being the category ID , which would be the primary key of the Category table and the foreign key of the SubCategory table. Using such a strucure would mean that you would not need to use any parsing to get the data you want; all you would need is a simple SQL :
select c.*, sc.* from category c, subcategory sc where c.categoryID = sc.categoryID and categoryID = <the category you want>
This would get you all the data related to the category you're looking for as well as all the subcategories realated to that specific category

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://183312]
[Lady_Aleena]: Lax, that would take it down to a little less than 100 characters. The module name is nearly 80 characters long.
Lady_Aleena has fumble fingers today.
[Lady_Aleena]: Sorry for the name typo LanX.
[LanX]: never lad_ena!
[LanX]: ;)
[Lady_Aleena]: IMO, Fancy::Join:: Grammatical isn't bad, but RolePlaying:: WorldBuilding:: WorldBuildersGuide book::ClimateTerra inSubsistance is on the long side.
[Lady_Aleena]: I'm still in reorganizing/ renaming mode.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-05-24 21:59 GMT
Find Nodes?
    Voting Booth?