Languages
[Edit]
EN

MySQL - boolean data type

2 points
Created by:
WGates
412

Simplest solution:

 

To use BOOL or BOOLEAN in MySQL we use TINYINT(1) data type.

With TINYINT '0' is false and '1' is true.

From MySQL documentation:

BOOL, BOOLEAN
These types are synonyms for TINYINT(1). A value of zero is considered false.
Nonzero values are considered true

Full MySQL documentation can be found here.

1. Database schema with boolean example

Edit

2. Adding boolean column to existing table example

Edit

MySQL query for add boolean column to existing table (alter table):

References

Edit
  1. Numeric type overview - MySQL docs
  2. Integer type - MySQL docs
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

MySQL - Problems

MySQL - boolean data type
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join