I am using MySQL database and JSP for a project. In my project there are categories like Philosophy, Technical, Art, Sports etc. These categories have multiple values like sports have hockey, cricket, football, etc. If I use a database to store this values, redundancy will occur.
e.g. sport-cricket,sport-hockey etc.
So my question is, Is there any efficient way to store these values so that when any person enter a cricket it compares with cricket in sports category?
It sounds like you have a classic many-to-many relationship.
A
categorycan have manyvaluerecords, and avaluecan be associated with manycategoryrecords.To model this, you would create three tables:
category,value, and a junction table,category_value.Category
Value
Category_Value