mysql UNIQUE KEY multiple columns with one column as NULL
Possibilities, you can:


use the BDB-Storage engine in MySQL prior 5.1. which treats nulls as non-distinct to each other. Later versions don't support BDB
introduce a special value for "no kid_id", so you won't have nulls
add a not-null pseudo column, which is filled by triggers and has to be in the constraint instead of the original kid_id
use a before-insert trigger instead of the constraint, which checks if there is a row containing all the 'unqiue' fields (use &lt;=> for also compare nulls) and changes the PK of the to-be-inserted-row to the one of the existing one so it results in a "Duplicate key" error.