I am modeling a database (MSSQL) and a question has arisen. In every customer business rule data is viewed vertically ex:
- Product,
- Original Price,
- Competitor Price01,
- Competitor Price02,
- Competitor Price03,
- Competitor Price04,
- Competitor Price05
- ReadMe
that is, you would define the 5 competitors and at worst would have to add a new column to a new competitor.
But my SQL knowledge says that I should normalize and put the data horizontally, even though I know the odds of a new competitor are small.
ex:
- Product
- Original Price
- Competitor Price
- Competitor Id; // 1 = Competitor 01, 2 = Competitor 02, etc.
- ReadMe
By doing the traditional (normalized) form, I have realized that I will have a lot of work to generate the reports as the client desires, since several lines will actually represent only one line for the report.
In SQL would have to query with PIVOT
Doubt:
What is the correct way in this modeling? Following the business rule of the customer and then denormalize to facilitate or follow the rigid norms of standardization? This is a scenario that for me would be an advantage to denormalize.