问题
I have designed a database with some outside help and I am thinking about a major change to the database model because of a problem creating reports in Power BI I have recently encountered here: SQL Power BI Report with Bridge Table
Disclaimer: if I could ask anyone within my firm, I would, but I can't.
We have a three-layer structure
- A main table
Firms
, with information about the year and unique key/name for each firm - A bridge table
Firm_Bridge
which information about the type of the firm linked toFirm_Types
- Many end Tables with information about sales and stuff
For these end tables, there are two types
Single type tables that only matter for one Type (
End_Table_Type_A
orEnd_Table_Type_B
) (often the case)Multi type tables that matter for more than one type (
End_Table_Type_all
) (rarely the case)
This is a made-up example similar to the real model
I am wondering if it was better to simplify this structure and directly connect the single type end tables to the firm table. I can still use the bridge table to document the type of firm and also connect the End_Table_Type_All to the firm's table. I imaging like this.
I hope this would avoid the problem that I have in my other question when summarizing stuff of end tables across years from Firms
and reduce the complexity of our data model, as most tables are only single type end tables. I can exclude one join for most queries.
I am afraid I am missing something and that the current way is the proper way to model this.
What would happen in the changed model if I were to join the 'Firm_Type' to 'Firms' and then the single Type end table 'End_Table_Type_A'. Would it fetch the single end type table for each type?
Then, my idea would be stupid and I need to find another solution to my problem.
回答1:
Just to give this closure. It seems to be indeed a stupid idea, because I would duplicate rows connected to the end tables, as soon as I merge the information of the type with the Firms table.
来源:https://stackoverflow.com/questions/65347482/database-modelling-remove-bridge-table