S
S
sinneren2016-04-30 15:08:52
SQL
sinneren, 2016-04-30 15:08:52

How to implement a DB table with an arbitrary number of columns?

There is a table, and here we are talking about a web muzzle, where in the first column the lines are, say, details, and in the header of an arbitrary number of other columns - dates. at their intersection we have text inputs, where you can record a certain state, comment, etc. These dates can be from 1-999+, that is, the plate stretches for as long as you like. Always different.
How to implement this in the database itself? The parts themselves are a separate table for matching with products and are connected to this product by an intermediate table 1 to many by id.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
landergate, 2016-04-30
@sinneren

You can create a separate table for dates by adding any number of dates there, one per row, linking them to a specific part ID from the first table.

R
Rsa97, 2016-04-30
@Rsa97

`table` (`part_id` INT, `date` DATE, `state` VARCHAR())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question