Dal punto di vista dello spazio occupato è più conveniente creare un campo booleano che può anche valere null oppure creare un campo not null di tipo enum(true,false,null)?
Dal punto di vista dello spazio occupato è più conveniente creare un campo booleano che può anche valere null oppure creare un campo not null di tipo enum(true,false,null)?
Come da manuale:
BOOL, BOOLEAN
These types are synonyms for TINYINT(1).
TINYINT[(M)] [UNSIGNED] [ZEROFILL]
A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.
The size of an ENUM object is determined by the number of different enumeration values. One byte is used for enumerations with up to 255 possible values. Two bytes are used for enumerations having between 256 and 65,535 possible values.
Quindi è uguale?
E quindi anche enum(bianco,nero) occupa lo stesso spazio di enum(bianco,nero,rosso,verde,giallo,blu)?