Reputation: 11
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
Reputation: 108500
9.1.6 Boolean Literals
The constants
TRUE
andFALSE
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
Reputation: 48207
You can use boolean in MySql
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