Say I have a ticket and this ticket has an owner and a taker. The owner ID is set when the ticket is created and the taker ID is set to default to NULL. In this case the taker may NOT also be the owner. I know this is trivial to do in the progamming logic but I am wondering if it can be done in the database.
Setting the two fields to unique :UNIQUE(owner_id, taker_id);
wont work as the owner can have many non-taken tickets at the same time. Perhaps a triple unique key along with the ticket ID, but then I feel there might be something lacking in my design.
An added bonus would be to see how this would be done in Django