1
I have a table NOTICIA
and in it I have a column ATIVO
The news may be active or not, if it is BOOLEAN (0 or 1) if ENUM (ACTIVE OR NON-ACTIVE) .
Which one would be better to use, BOOLEAN or ENUM ?
1
I have a table NOTICIA
and in it I have a column ATIVO
The news may be active or not, if it is BOOLEAN (0 or 1) if ENUM (ACTIVE OR NON-ACTIVE) .
Which one would be better to use, BOOLEAN or ENUM ?
3
Since Mysql 5.0.3 you have the type BIT(quantidade de bits)
which may be used in such cases, if specified BIT(1)
.
Boolean
is just one alias for TINYINT(1)
.
Enum
as its name already says, it is for enumerations, ie a list of values "named", internally is stored as number, turns out to be no better than and the Boolean
internally.
Some links that might interest you about these types:
-5
I suggest never using BOOLEAN in tables, because it is routine to appear a posteriori requirements that require more than two states. Use ENUM or even a simple INT.
Browser other questions tagged mysql database mysqli enums boolean
You are not signed in. Login or sign up in order to post.
In my opinion, it is active or not, clearly it is boolean. Now, if there are more than two states, e.g., status: published, draft, excluded, pending, etc.
– Woss
Possible duplicate of BIT(1) versus TINYINT(1) for boolean values
– Guilherme Nascimento