Aviel Fedida
Aviel Fedida

Reputation: 4102

MySQL: the SET Type

I am learning about "(MySQL) - SET Type", At the Mysql, I didn't understand the following statement: The Link: The SET Type.

MySQL stores SET values numerically, with the low-order bit of the stored value corresponding to the first set member. If you retrieve a SET value in a numeric context, the value retrieved has bits set corresponding to the set members that make up the column value.

As they saying "numerically" i understand that "Behind the scenes" there is 2 columns, 1 With the SET members and 1 with the numeric values following by the binary system(1,2,4,8,16,etc..).

Also i didn't get this statment:

If a number is stored into a SET column, the bits that are set in the binary representation of the number determine the set members in the column value. For a column specified as SET('a','b','c','d'), the members have the following decimal and binary values.

The big picture I do not understand under what values the SET members stored in the database and would be very happy if some one may help me, Thank you all and nice day.

Upvotes: 1

Views: 695

Answers (1)

amk
amk

Reputation: 282

The SET data type values are stored as integer numbers, and SET values ('val1', 'val2'...) are stored in bits; 64 values are possible - 8 bytes integer number.

There is an article about the SET type and its using - How to edit values of SET data type.

Upvotes: 3

Related Questions