John
John

Reputation: 11

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"

Upvotes: 1

Views: 4346

Answers (2)

spencer7593
spencer7593

Reputation: 108500

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

Upvotes: 2

Juan Carlos Oropeza
Juan Carlos Oropeza

Reputation: 48207

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;

Upvotes: 0

Related Questions