简体   繁体   中英

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. I can choose BOOLEAN (or TINYINT) and use the values 1 and 0 but was just wondering about the values "true" and "false"

9.1.6 Boolean Literals

The constants TRUE and FALSE evaluate to 1 and 0, respectively. The constant names can be written in any lettercase.

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

You can use boolean in MySql

SQL DEMO

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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