I have designed a database for a transport management program. And one part seems to be OK, but I’m not sure how to store a combination from Package, Price and Version to a Project, to avoid a circular reference.
Just a short explanation of the database: A Package can have one to many Prices and has one to many Versions. So the Prices are independent from the Version. E.g. if you have 2 Versions, they have the same Price. A Version can have one to many Equipment’s and also a Equipment can belong to many Versions. A User filters over Package and chooses a Package, after that he chooses the Version and the Price and stores this in Project_Has_Packages. Just as you see in the picture. Database Design Picture
My approach was, that the PackageName only comes from the Package-Table and the VersionName and PriceName from the specific Tables. In the Pricing-Table and Version-Table I need the PackageName to make the entries unique, because it’ll could be you have “Package1” and “Version1” and “Version2” and also “Package2” with “Version1” and “Version2”. The Versions are different because of the different Equipment, which belongs to the Version. If I make the VersionName unique (“ver1 Pack1”) then the database isn’t normalized any more. Is there a possibility to avoid the circular reference and how can I change the design to avoid this? Thinking the whole day about it and I can’t see the wood for the trees anymore.