Doubt to create mysql table with monthly and quarterly values

1

I need to create a table called "evaluation" in which once a month must enter values of a simple formula a / b, that is, a field for a, another for b and a third for the result. First, the table would look like this: idEvaluacion,idProducto,fecha,denominador(a),numerador(b),resultado .

The problem is that I do not know if this structure works, because in addition I must store (or calculate dynamically, there is my doubt) the totals quarterly throughout the year. I planned to make a large table with one field for each month and between half another field for each quarter.

I have only two tables for this:

productos
------------
idProducto int,
nombre varchar

evaluacion
-----------------
idEvaluacion int ai,
fk_idProducto int,
fecha datetime,
denominador int,
numerador int,
resultado int

Any advice?

    
asked by daniel2017- 30.03.2017 в 20:08
source

1 answer

2

Your structure fits perfectly for what you want to do.

The other problem that you mention, about how to show the results is a problem of the view and not of the database.

Your data can be resolved quarterly with a query grouped by quarters (you could have a column year-quarter or calculate it in the same query) and from there in your view go mixing the data.

    
answered by 30.03.2017 в 21:32