Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Workbench: trying to create a boolean field for a table

I'm trying to create a new column as boolean type, but I can't find it in the list..any help?

5.2.37 and ubuntu 11.10

like image 765
ziiweb Avatar asked Feb 21 '12 17:02

ziiweb


3 Answers

There is no such thing as a 'boolean' in MySql unfortunately.

I think you need tinyint(1).

This question has more: Which MySQL data type to use for storing boolean values

like image 125
Widor Avatar answered Oct 19 '22 14:10

Widor


Skip the workbench and use the command line

alter table my_table add column my_column BOOLEAN;
like image 42
Pieter Van Keymeulen Avatar answered Oct 19 '22 15:10

Pieter Van Keymeulen


To Create a Boolean Column in Table with default false

ALTER TABLE table_name ADD field_name tinyint(1);

if default true

ALTER TABLE table_name ADD field_name tinyint(0);   
like image 1
Rakesh Avatar answered Oct 19 '22 13:10

Rakesh