N
N
NoName_02016-08-31 09:53:44
MySQL
NoName_0, 2016-08-31 09:53:44

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

2 answer(s)
M
Maxim Fedorov, 2016-08-31
@NoName_0

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.

E
evgeniy_lm, 2016-08-31
@evgeniy_lm

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 question

Ask a Question

731 491 924 answers to any question