I have a table, "foo", in my database with primary key "fooID."
I have a second table, "fooAttributes," with a foreign key that references foo.fooID.
I'd like to have a composite key on the fooAttributes table (fooID, attributeNumber), where attributeNumber increments automagically on a per-foo basis when I insert a new attribute. So foo number 1 would have attributes 1, 2, 3... and foo number 2 would have attributes 1, 2, 3... etc.
What kind of SQL-fu is necessary to accomplish this? Is it practical? (I'm sure that it's possible, given enough effort.)