benjisail benjisail - 20 days ago 8
MySQL Question

How can I ensure that there is one-and-only-one row in DB table?

I would like to ensure that my MySQL table named "myTable" has one-and-only-one row.

So I need to be able to do Update on this row but obviously Insert and Remove should be not possible.

I am asking this question because of this Stack Overflow answer

Thanks!

Answer

Two suggestions for you, one or both which may work depending on the particulars of the data you're trying to store:

AND/OR