简体   繁体   English

MySQL Workbench中的True / False数据类型

[英]True/False datatype in MySQL Workbench

Hi I would like to know what datatype allows me to use the values: true or false in my table. 嗨,我想知道什么数据类型允许我使用以下值:表中的true或false。 I can choose BOOLEAN (or TINYINT) and use the values 1 and 0 but was just wondering about the values "true" and "false" 我可以选择BOOLEAN(或TINYINT)并使用值1和0,但只是想知道值“ true”和“ false”

9.1.6 Boolean Literals 9.1.6布尔文字

The constants TRUE and FALSE evaluate to 1 and 0, respectively. 常数TRUEFALSE取值为1和0。 The constant names can be written in any lettercase. 常量名称可以用任何字母大写。

Reference: https://dev.mysql.com/doc/refman/5.7/en/boolean-literals.html 参考: https : //dev.mysql.com/doc/refman/5.7/en/boolean-literals.html

You can use boolean in MySql 您可以在MySql中使用布尔值

SQL DEMO SQL演示

DROP TABLE IF EXISTS MyGuests;

CREATE TABLE MyGuests (
    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    test boolean
);

INSERT INTO MyGuests (test)
    VALUES (true);

SELECT * FROM MyGuests;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM