U
U
Umar Ilyasov2020-07-14 11:41:35
MySQL
Umar Ilyasov, 2020-07-14 11:41:35

How to merge multiple fields in a database?

There is a table in the database of categories, which has nowhere to fill.

I want to make a second table in the database. And the question arose of how to combine them so that categories are displayed on the site without problems. The total number of categories is about 2000-2100 pieces.

It’s not an option to push it into one table, since there are a lot of nested categories, and an error is displayed there, they say, for parent_id, select a number less than 255, for example, the category id is 769, and its 769 for parent_id is not an option.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
di, 2020-07-14
@Delgus

Do you have a category tree or what?
here is described in some detail in the solution - Storing trees in Mysql what are the ways?
we drive into Google - 'mysql tree' - we find a lot of useful information.
parent_id is missing, so change the column type.
ALTER TABLE table_name MODIFY column_name .....
The second, third and fourth tables are not needed


that has nowhere to fill...

Apparently you have not seen tables with 50 million rows, your example is a crumb

A
Arman Hovhannisyan, 2020-07-14
@Armrisch

In my opinion, you have an error in the table, for parent_id, select an integer and set the length to 11,
In the course, you have varchar 255

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question