April 21st, 2013, 08:16 AM
How to store unknown parameters?
1. I want to store a number of options that will be used for search queries later.
E.g. category, age group, location...
Normally I would just add a column for each of those. However, in this case it would be many columns and it is not yet sure which ones exactly and some may be added later.
What would be best practice to handle that situation?
Save all parameters in a text field (e.g. as json) and handle the string in the application later?
2. I have a many-to-many relationship for markers and their categories. Right now I use a view that joins those tables. The output shows multiple rows for each marker if it is assigned to multiple categories. Is it possbile to have only unique rows and the categories added as columns instead?
This question is extremely vague. What type of thing are you searching through and how are the search parameters used in the search?
From what you wrote above there is one thing I can say for sure: storing everything as a text field in a single column for processing i an application later is a bad idea. That sort of thinking completely disregards what a database is for (providing answers).