Answer the question
In order to leave comments, you need to log in
Storing an array in a database?
There is a task, you need to somehow store the description and characteristics of the goods in the database, despite the fact that different goods have different lengths of the characteristic and description? I stopped at the fact that you can serialize an array (with an arbitrary length and number of elements, as I need) into a string and shove this string into the database already .. So, how correct is this and is there an alternative to this? how do popular online stores store descriptions and characteristics?
Answer the question
In order to leave comments, you need to log in
To store such data in a serialized array is not true at all. For such tasks, either three tables are created:
- Goods
- Characteristics
- Characteristic value for goods
or NoSQL databases are used. And the choice of these approaches should be made based on the requirements and loads of your system.
in all databases known to me there is a BLOB type (or something like that) you can shove anything there, even text, even pictures, even videos, even all at once
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question