mysql - Is it possible to create 2 fields that may NOT have the same value? -


I have a ticket and this ticket has one owner and one viewer. Owner ID is determined when the ticket is made and the buyer ID is set to the default. In this case the laser may not even be the owner. I know that in programming logic it is trivial to do this, but I am thinking that it can be done in the database.

Setting Two Fields to Unique: UNIQUE (owner_id, taker_id); In the form of not working, the owner can get many non-tickets at the same time, probably with a triple digit unique key, but then I think there may be some deficiency in my design .

An additional bonus is to see how this will be done in Django

Django In, you can use "unique_tagier" in your model.

Unique_Together = (("Owner", "Buyer"),)


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -