mysql>
    mysql> select * from ingredients;
    +------+---------------+-----------+
    | id   | name          | available |
    +------+---------------+-----------+
    |    1 | salt          | n         |
    |    2 | sugar         | n         |
    |    3 | flour         | n         |
    |    4 | butter        | n         |
    |    5 | vanilla       | n         |
    |    6 | baking powder | n         |
    |    7 | egg           | n         |
    +------+---------------+-----------+
    7 rows in set (0.00 sec)
    mysql> select * from recipes;
    +------+---------------+
    | id   | name          |
    +------+---------------+
    |    1 | cookie        |
    |    2 | soup          |
    |    3 | xtreme flavor |
    +------+---------------+
    3 rows in set (0.00 sec)
    mysql> select * from recipe_ingredient;
    +-----------+---------------+
    | recipe_id | ingredient_id |
    +-----------+---------------+
    |         1 |             1 |
    |         1 |             2 |
    |         1 |             3 |
    |         1 |             4 |
    |         1 |             5 |
    |         1 |             6 |
    |         1 |             7 |
    |         2 |             1 |
    |         2 |             7 |
    |         3 |             4 |
    |         3 |             3 |
    +-----------+---------------+
    11 rows in set (0.00 sec)
    mysql>
    mysql> update ingredients set available = 'n';
    Query OK, 0 rows affected (0.00 sec)
    Rows matched: 7  Changed: 0  Warnings: 0
    mysql>
    mysql> update ingredients set available = 'y'
        -> where id in  (1,2,3,4,5,6,7);
    Query OK, 7 rows affected (0.00 sec)
    Rows matched: 7  Changed: 7  Warnings: 0
    mysql>
    mysql> select recipes.name from
        -> (select recipe_id, available from
        -> recipe_ingredient,
        -> ingredients
        -> where ingredient_id = ingredients.id
        -> group by  recipe_id, available) x, recipes
        -> where recipes.id = x.recipe_id
        -> group by x.recipe_id
        -> having count(*) = 1
        -> and max(x.available) = 'y';
    +---------------+
    | name          |
    +---------------+
    | cookie        |
    | soup          |
    | xtreme flavor |
    +---------------+
    3 rows in set (0.06 sec)
    mysql>
    mysql> update ingredients set available = 'n';
    Query OK, 7 rows affected (0.00 sec)
    Rows matched: 7  Changed: 7  Warnings: 0
    mysql>
    mysql> update ingredients set available = 'y'
        -> where id in  (1,7);
    Query OK, 2 rows affected (0.00 sec)
    Rows matched: 2  Changed: 2  Warnings: 0
    mysql>
    mysql> select recipes.name from
        -> (select recipe_id, available from
        -> recipe_ingredient,
        -> ingredients
        -> where ingredient_id = ingredients.id
        -> group by  recipe_id, available) x, recipes
        -> where recipes.id = x.recipe_id
        -> group by x.recipe_id
        -> having count(*) = 1
        -> and max(x.available) = 'y';
    +------+
    | name |
    +------+
    | soup |
    +------+
    1 row in set (0.06 sec)
    mysql>
    mysql>
    mysql> update ingredients set available = 'n';
    Query OK, 2 rows affected (0.00 sec)
    Rows matched: 7  Changed: 2  Warnings: 0
    mysql>
    mysql> update ingredients set available = 'y'
        -> where id in  (4,3);
    Query OK, 2 rows affected (0.00 sec)
    Rows matched: 2  Changed: 2  Warnings: 0
    mysql>
    mysql> select recipes.name from
        -> (select recipe_id, available from
        -> recipe_ingredient,
        -> ingredients
        -> where ingredient_id = ingredients.id
        -> group by  recipe_id, available) x, recipes
        -> where recipes.id = x.recipe_id
        -> group by x.recipe_id
        -> having count(*) = 1
        -> and max(x.available) = 'y';
    +---------------+
    | name          |
    +---------------+
    | xtreme flavor |
    +---------------+
    1 row in set (0.05 sec)
    mysql>
    mysql>
    mysql> update ingredients set available = 'n';
    Query OK, 3 rows affected (0.00 sec)
    Rows matched: 7  Changed: 3  Warnings: 0
    mysql>
    mysql> update ingredients set available = 'y'
        -> where id in  (1,3,7);
    Query OK, 3 rows affected (0.00 sec)
    Rows matched: 3  Changed: 3  Warnings: 0
    mysql>
    mysql> select recipes.name from
        -> (select recipe_id, available from
        -> recipe_ingredient,
        -> ingredients
        -> where ingredient_id = ingredients.id
        -> group by  recipe_id, available) x, recipes
        -> where recipes.id = x.recipe_id
        -> group by x.recipe_id
        -> having count(*) = 1
        -> and max(x.available) = 'y';
    +------+
    | name |
    +------+
    | soup |
    +------+
    1 row in set (0.06 sec)