| ▲ | larsnystrom 6 hours ago | ||||||||||||||||||||||
Why are they storing a time period (start and end date) in the first example? Why not just store the date when the price comes into effect? That would make both overlaps and time travel impossible without using any constraints. | |||||||||||||||||||||||
| ▲ | advisedwang 5 hours ago | parent | next [-] | ||||||||||||||||||||||
JOINs and other operations become really difficult if you can't evaluate whether a row applies or not based on that row alone. | |||||||||||||||||||||||
| ▲ | throwaway7783 6 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
Works when there is always an active price. Having an explicit end date allows certain rows to be inactive automatically after validity period. Think of seasonal categories/products etc which dont exist after a specific period | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | yourMadness 4 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
If you sell a product where the customer can buy the future version today (for delivery in the future), that doesn't work. | |||||||||||||||||||||||
| ▲ | quotemstr 6 hours ago | parent | prev | next [-] | ||||||||||||||||||||||
It's a trade-off. If you store both endpoints you can continue to think of rows as order-invariant tuples. If you store only one endpoint, you have to impose a meaningful order on the rows in order for them to make sense. | |||||||||||||||||||||||
| |||||||||||||||||||||||
| ▲ | warmwaffles 5 hours ago | parent | prev [-] | ||||||||||||||||||||||
It's a contrived example. | |||||||||||||||||||||||