Which MySQL data type to use for storing boolean values

前端 未结 13 1840
感情败类
感情败类 2020-11-22 04:45

Since MySQL doesn\'t seem to have any \'boolean\' data type, which data type do you \'abuse\' for storing true/false information in MySQL?

Especially in the context

13条回答
  •  我在风中等你
    2020-11-22 05:22

    I use TINYINT(1) in order to store boolean values in Mysql.

    I don't know if there is any advantage to use this... But if i'm not wrong, mysql can store boolean (BOOL) and it store it as a tinyint(1)

    http://dev.mysql.com/doc/refman/5.0/en/other-vendor-data-types.html

提交回复
热议问题