Question: I'm trying to create a table that represents an instruction in a recipe:

```
+---------------------+
| recipeId   (PK, FK) |
| stepNumber (PK)     |
|---------------------|
| instruction         |
+---------------------+

```

The idea is to have a primary key of `(recipeId, stepNumber)` where the `recipeId` comes from the `recipe` table and the `stepNumber` auto-increments.

When I tried to create this table, I got the following error:

```
#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key 

```

Is what I'm trying to do correct/possible?

Answer: 
I do have to ask - why would you want to? If you think about it, your recipe Id (FK) is going to be unique, then your step number is always going to start from 1 (or zero if you're zero based).

-- edit --

```
steps table:
recipe_id step_id step_detail
--------- ------- ---------------------------
        1       1 blah
        1       2 blah
        1       3 blah
        2       1 blah
        2       2 blah
        2       3 blah
        2       4 blah
        2       5 blah
--------- ------- ---------------------------

```

If you included an auto-increment here then the step numbers would just keep on going up instead of resetting to 1 for the next recipe.

-- end edit --

Kind regards,
Westie.
I don't think you can do this with InnoDB if thats what you are using. Apparently you can with MyISAM.

<http://dev.mysql.com/doc/refman/5.6/en/example-auto-increment.html>