Why does MySQL boolean type map to tinyint instead of enum?

Have you had tinyint (1) performance or compatibility considerations over an enumeration? Something else?

+3
source share
2 answers

You may be interested to know that MySQL indexes ENUM with integers .

The SQL standard has included a Boolean data type since 1999, with valid values ​​being true, false, unknown, or null. Implementation in various database systems is spotty .

MySQL does not support the true boolean data type - BOOLEAN maps to TINYINT, which takes only 1 byte. MySQL interprets 0 as false, all other numbers are true.

+2

, 8 , . Tinyint int. . MySQL bools, , .. .

+1

Source: https://habr.com/ru/post/1782648/


All Articles