i am creating a table. and i am using some update queries on it.
this table has placeId, noOfGirls, noOfBoys. due to some update queries the values of these two fields noOfGirls and noOfBoys becomes negative.
Is there a way so i can convert these negative values to 0. means any constrains or something else so i can protect to be value negative.
Thank you in advance.
Declare the column as
unsigned inttype.The unsigned range is 0 to 4294967295, so the value never become negative.
You can alter the schema of your existing table
alter table table_name modify column noOfGirls int(10) unsigned;You can read it more here