I have inherited a database schema, which looks similar to the one below:
CREATE TABLE Products (
ProductID int not null PRIMARY KEY,
StoreGroupID int not null,
-- product properties...
)
CREATE TABLE Stores (
StoreID int not null PRIMARY KEY,
StoreGroupID int not null,
-- store properties...
)
The idea is that there's a 1-* correspondence between a product and a group of stores (a product is always carried by a single group of stores, and a group of stores can carry multiple products).
However, the current database does not define any sort of "group of stores" entity - the StoreGroupID
is instead assigned by the business logic code from a sequence, completely arbitrarily and with no foreign key constraint.
Does it make sense to create a StoreGroup
table, even if the only column it could carry would be the StoreGroupID
? Or is there another way to model such a relationship?