How to create a “unique” constraint on a boolean Mysql column?
I would like to add a BOOLEAN column to a MySQL table which will be named is_default . In this column, only one record can have is_default set to true . How can I add this constraint to my column with mysql? Thanks! UPDATE If it is not a constraint that I should add. How are we dealing with this type of problem on DBs? I think this is not the best way to model the situation of a single default value. Instead, I would leave the IsDefault column out and create a separate table with one row and only the column(s) that make(s) up the primary key of your main table. In this table you place the PK