1
I have the following database:
Requirements:
the prices of the lunch boxes and the address of the customers can be amended as necessary.
every week I need to generate a report from that database, which shall contain the information according to the time of the operation.
Problem:
If I modify the value of a lunch box, all orders made using reference to this lunch box will become useless, reporting something that is not correct, making the calculated total value of the already completed orders change (unacceptable). then I must make a choice:
allowing the report to be generated in the range you want:
create other tables, just for the report, where each request saves all duplicated information so there is no total price inconsistency in the report.
do not change the values, just mark the box as 'inactive' and create another with changed value, the same with the customer (removing the phone as a primary key).
duplicate only the fields that change, in the requested item the price of the lunch box, and in the order the address and reference point of the customer.
do not care about the items or address, just put in the order a Total Value field
allowing the report to be generated only from week to week:
generate the report while the requests are performed. for example, each request add a line in an Excel file of the respective week.
prevent changes from being made, unless it is immediately after having done the report of the week (which is saved in another file, for example Excel spreadsheet), and there is still no request performed.
any of these options is acceptable to my scenario, I just ask what would be the "most correct" (or if I thought about it in a totally wrong way and generating report is something else), since almost all break normalization, or why the database exists for conversation start.
A question a little too big for a simple lunch, on item_request create another field with the value of the lunch box and good appetite.
– Marco Souza
Do you know that you can vote for everything on the site, as well as accept an answer in your questions? Visit the [tour].
– Maniero