mysql - Should I store additional data in SQL join/junction table? -


are there drawbacks storing addition data in join/junction table.

for example, working on database of trucking companies , have 3 tables:

table 1 - company, table 2 - trailer_type, table 3 - junction_table, 

each company can have more 1 trailer type, need trailer count of each trailer type per company. logic place put trailer count seem in junction table company.id , trailer_type.id.

are there drawbacks doing way , if there better way?

from way phrased question, think intuition correct. identified junction table place keep counts. you're hesitating, apparently because it's "junction table".

all tables created equal. point of view of sql, there no fact tables, no dimension tables, no junction tables. there tables.

a normalized design denotes minimal key identify each row. in case, natural key of junction table {company_id, trailer_type_id}. there information that's functionally dependent on key? why, yes, there is: ntrailers. column born.

so don't worry kind of table is. think row means, , how it's identified. keep on fairway.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -