I have two tables in a SQLite DBMS:
Shop(PK, A1, A2, A3) where PK is Primary Key `A1..An` are nullable attributes;
Product(PK, FK) where FK references Shop(PK) and PK|FK is Primary Key
Shop typically has 5 or 6 entries in a database instance.
The problem is that when a new product is inserted, it is very often present in ~all the shops, so now the user effectively has to insert 5 or 6 rows at a time (where PK is repeated in each row - PK consists of a long attributes in the real case).
I wonder if there's a way to make the life easier for the user by associating one product to all the shops by default, by either refactoring the schema (e.g. maybe using flags?) or by triggering all the insertions when a new product appears (is it tricky?), or both the things. Note that one product must be present in at least one shop. I want the solution to be as less obscure as possible and easy to maintain.
Aucun commentaire:
Enregistrer un commentaire