November 20th, 2013, 02:57 PM
Multiple values in SQL column
I was thinking about a search option where you can search for one or more keyword(s) stored in a table. I don't know how much keywords there will be but there could be a maximum number. So it would be great if I could just get all the values and store them in one column keywords.
Is this even possible? If yes, how do I do this?
Thanks in advance
November 20th, 2013, 03:20 PM
storing multiple values in a column is wrong in the relational model. Look up the concept of normalization, especiall the first normal form.
To assign multiple keywords to multiple entities (whatever those are), you need one table for the keywords and one table for assigning keywords to entities.
Let's say the keywords belong to products:
To get all products for a given keyword, you use a join:
- product_id, references products (product_id)
- keyword, references keywords (keyword)
JOIN product_keywords USING (product_id)
product_keywords.keyword = 'whatever'
November 20th, 2013, 03:41 PM
Ok, thanks for the quick response and explanation.
Something else, I used to get emails from devshed when someone replied to a thread, but lately I haven't receive any on the newer threads but I still do on the older ones (like the thread 'How to make a basic but secure login-system'). Do you have the same problem? It didn't go to the spam, I use the same mail and I didn't change anything in the 'notification' in the threads.
November 20th, 2013, 04:22 PM
If the replies come close to a time when you're active on the site then they might not send. And I can confirm it does look like you're subscribed to this thread.
If it's definitely not sending the notifications then mention it in Suggestions & Feedback.