Reputation: 799
I want to store a string in my table. The string will contain several substrings with a delimiter, the char ",".
Does varchar fit?
Upvotes: 0
Views: 5231
Reputation: 116197
VARCHAR will work for you. But it does not mean that this is the right way to do it.
You should consider creating schema that stores each sub-string in separate row or column. This way data will be easier to read, write and, most importantly, search.
Upvotes: 1
Reputation: 91942
Yes, VARCHAR is the preferred datatype to store strings.
Storing multiple values in the same field is not preferred, however. A multivalued attribute is usually implemented as a table in the database design.
Upvotes: 3