mysql always set at least zero / cannot use negative numbers column type : int unsigned select GREATEST(cast(column_name as signed) + (- 1), 0) from table_name; check this link: mysql GREATEST