I have a table which have the following structure, the columns are origin, destination, traveltime, and departure time. The primary key are a composite of origin, destination, and departure time. Is there any way to re-structure this so that there isn’t too many duplication of origin and destination in the rows?
I have a table which have the following structure, the columns are origin, destination,
Share
The presence of “too many duplication[s] of origin and destination” doesn’t matter. It’s only part of your unique key and it’s necessary. If you really want to, you can create a separate table like this:
And then in the original table your PK would be
But, you’re still just going to have a bunch of duplicate OriginDestinationKeys. I wouldn’t worry about it, as long as the structure/definition makes logical sense, having those duplicates isn’t a huge deal. If you want to separate it so its easier to report off of, etc., then feel free to separate them out.