Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
whats wrong in this data model?
Is it correct that there is a syntactic key?
If you want to do away with the synthetic keys, create a complex key that concatenates the vlues from the three shared fields in a single (new) key field and drop the base fields from every table except the one containing the largest number of shared values (the superset). In case there is no superset table, you may need to create a LinkTable to make connections to the other tables work as expected. Otherwise you'll get unwanted filtering because of selections in tables with value subsets < 100%
Or - and this is usually better for performance - .put all Ventas, NotasDeCredito & Devoluciones in a single table and leave the key fields as they are. Add an identifier field that contains one of three possible strings, to tell you what type of row your are looking at.
Yes, you have a synthetic key.
The top 3 tables have more than 1 field in common, so you get a synthetic key.
More information here: Synthetic Keys by hic
If you want to do away with the synthetic keys, create a complex key that concatenates the vlues from the three shared fields in a single (new) key field and drop the base fields from every table except the one containing the largest number of shared values (the superset). In case there is no superset table, you may need to create a LinkTable to make connections to the other tables work as expected. Otherwise you'll get unwanted filtering because of selections in tables with value subsets < 100%
Or - and this is usually better for performance - .put all Ventas, NotasDeCredito & Devoluciones in a single table and leave the key fields as they are. Add an identifier field that contains one of three possible strings, to tell you what type of row your are looking at.
if ur getting the expected values on ur reports with this data model then there is no problem with this synthetic key(because ur having only one key in ur model)
if u have some data issues, u need to redefine the model like Peter suggested by creating complex key or by creating separate table for all key fields and map each individual keys with other tables.
i did this:
what do you think?
It's good for view