I have a simple database with two tables :
Catalog (
id_catalog
, name )
Product (
id_product
, name, quantity, id_catalog# )
None of those fields can be empty, so I put a NOT NULL
constraint everywhere.
But I need that two products couldn't have the same name if they are in the same catalog. How could I do that?
I mean
1, chocolat, 5, 1
2, chocolat, 7, 2
those are OK because they are in two different catalogs, but :
1, chocolat, 5, 1
2, chocolat, 7, 1
should not be allowed, because I shouldn't accept chocolat twice in the same catalog.