List:General Discussion« Previous MessageNext Message »
From:Gerald Taylor Date:February 18 2005 3:18pm
Subject:MySQL constraint question
View as plain text  
I have a database thats full of ingredients that are placed in various
categories.  and then there are mixtures that are allowed to
be labelled with a certain grade based on the quality and
composition of the ingredients it is comprised from.
But the formulas are not always the same, as long as the profile matches 
certain criterian.

For example, in order to be label grade Premium,
it must have between 70% and 95% ingredients from group A
between 0 and 15 % from group B
between 5 and 15% from group C
between 0 and 15% from group D


What you actually put in the mix is determined by price
and availability and other factors.

So I  implement these profiles with a mySQL table
I have

grade_id               points to main grade record
category_id            points to category
min_percent
max_percent

and the individual ingrediants

ing_id
name
price
category_id    among others...

The question is
Is there some way mysql can assure the integrity of these profiles, so 
that there is no way to use a set of records for a grade that can't add 
upto 100%.     Or is this pretty much application logic?


Thread
MySQL 4.1.9 - Requesting Optimization TipsMatt Florido18 Feb
  • Re: MySQL 4.1.9 - Requesting Optimization TipsPaul DuBois18 Feb
    • Re: MySQL 4.1.9 - Requesting Optimization TipsMatt Florido18 Feb
      • Re: MySQL 4.1.9 - Requesting Optimization TipsPaul DuBois18 Feb
      • MySQL constraint questionGerald Taylor18 Feb
        • Re: MySQL constraint questionSGreen22 Feb
          • Re: MySQL constraint questionMartijn Tonies22 Feb
            • Re: MySQL constraint questionGerald Taylor23 Feb