i am trying to model some tables for an ecommerce database. there is a manufacturers table. manufacturers have products (products table) and products have SKUs (SKU table). there are actually more levels than this, but to simplify the problem, we'll stick with that.
now i need to add pricing rules. i need to be able to add a pricing rule to a manufacturer (such as 10% off all prices), which would affect any products and SKUs under this manufacturer. i also need to be able to add pricing rules at the product level (which would affect all SKUs under the product) and SKU levels. there also has to be a priority, for example, if a SKU has a pricing rule, that rule should be used before the rule for the manufacturer.
what is the best way to set this up? so far i have come up with having a pricing rules table at each level, but it seems like the queries would be horrible. any advice?