Mysql WorkBench: varchar default value as empty

Before I started using MySql WorkBench, I used phpmyadmin and loved setting default values ​​for varchars to empty. Therefore, in my code, I would not need to check for null values ​​and use it only if the $ value = '' comparison. How to set default value as empty in mysql workbench? If I leave the text field empty, unlike phpmyadmin, it seems to me that I do not want the default value.

Thank you

Imran

+7
mysql mysql-workbench
source share
2 answers

Just put two quotation marks '' in the default field for your column.

Assigning an empty string as a default value in MySql Workbench

Or right click on the column and select Default ''

Assigning an empty string as a default value from context menu in MySql Workbench

+15
source share

There is an error in Workbench that does not allow updating an empty line (it says no changes). I set it to the field first, '' and then changed the sql code to an empty string. '' It does the trick.

+1
source share

All Articles