Link to home
Start Free TrialLog in
Avatar of Paer Toernell
Paer ToernellFlag for Thailand

asked on

Change a boolean column to default False

To add a boolean column with the default value "False" works:
 
ALTER TABLE `platsonline`.`attribut_lists` 
   ADD COLUMN `B_TEST3` BOOLEAN DEFAULT TRUE NULL

Open in new window


But to change it when its already created?
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

BOOLEAN fields are synonomous with tinyint(1).  Just set it to 0 or 1.
Avatar of Paer Toernell

ASKER

I seen all these examples, when i run them in MysqlYog they dont work. I need working code.
UPDATE platsonline SET B_Test3=0

will set the field to FALSE.



UPDATE platsonline SET B_Test3=1

will set the field to TRUE.
(Don't forget to add a WHERE clause to set just one row, otherwise these mysql statements will set every row in the table)
Thanx, but that wont do. I want the default value to be automatic set to False.
ASKER CERTIFIED SOLUTION
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial