Oto Shavadze
Oto Shavadze

Reputation: 42773

Better type for storing 2 different single char

When in column must be stored only 2 values: 0 or 1,

What is the best column type choice for this column: "char" or ENUM('0', '1')?

Upvotes: 0

Views: 83

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656942

As mentioned in the comments, this should be neither char nor enum, but a boolean.

FALSE translates to 0.
TRUE translates to1.
If you want to disallow NULL values define the column NOT NULL.

Upvotes: 1

Related Questions