【dbdao.com MySQL OCP认证专题】- MySQL 5.6 - OCP 考题讲解 - 4
【dbdao.com MySQL OCP认证专题】- MySQL 5.6 - OCP 考题讲解4.
When designing an InnoDB table, identify an advantage of using the BIT datatype Instead of one of the integer datatypes.
A.
BIT columns are written by InnoDB at the head of the row, meaning they are always the first to be retrieved.
B.
Multiple BIT columns pack tightly into a row, using less space.
C.
BIT(8) takes less space than eight TINYINT fields.
D.
The BIT columns can be manipulated with the bitwise operators &, |, ~, ^, <<, and >>. The other integer types cannot.
------------------------------------------------
答案:C
分析:
关于数据类型的存储,可查看http://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html
A, B都没有特别在guide中提到。
BIT(8)大致长度为1个Byte, 8个tinyint的存储长度相当于一个bigint了, 请注意并不是说tinyint(8),括号中为可显示的长度,由于一个tinyint为1个Byte,因此8个自然要更长。因此C正确。
D错,int类型值夜可以进行bit操作符的操作
参考:
关于数据类型的存储,可查看http://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html
页:
[1]