Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Do we remember/know that set is a bitmask that can store multiple values at the same time?
The tinyint equivalent is enum. (well, or set, but then with the implementation of a bit mask, otherwise why was it necessary to do a set?)
If there can be only one value at 1 point in time - enum.
If there are several - set.
Simply because the textual representation is easier to understand than the numerical one.
All three on identical data ranges occupy an equal place. dev.mysql.com/doc/refman/5.1/en/storage-requirements.html
And it depends where you use it. In fact, both are small, both will take up little space, but for me personally the difference is obvious:
SELECT * FROM `cars` WHERE type = 4
and
SELECT * FROM `cars` WHERE type = 'hatchback'
These queries are the same, but they say one essential advantage of set (aka enum)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question