Skip to main content
Commonmark migration
Source Link

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain in Numeric Type Overview:

BOOL, BOOLEAN

 

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

 

...

 

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

 

...

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain in Numeric Type Overview:

BOOL, BOOLEAN

 

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

 

...

 

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

 

...

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain in Numeric Type Overview:

BOOL, BOOLEAN

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

...

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

...

added 30 characters in body
Source Link
ypercubeᵀᴹ
  • 100k
  • 13
  • 217
  • 306

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain in Numeric Type Overview:

BOOL, BOOLEAN

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

...

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

...

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain:

BOOL, BOOLEAN

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

...

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

...

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain in Numeric Type Overview:

BOOL, BOOLEAN

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

...

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

...

added 479 characters in body
Source Link
ypercubeᵀᴹ
  • 100k
  • 13
  • 217
  • 306

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain:

BOOL, BOOLEAN

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

...

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

...

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

A tinyint column can hold values from 0 to 255 (if it is defined as unsigned) or -128 to +127 (if it is signed). The (1) in tinyint(1) is only for some formatting options and generally ignored. You could create it as tinyint(100) and it wouldn't make a difference.

Regarding the TRUE or FALSE, any int (int, tinyint, smallint, bigint) value can be used as (or converted to) a boolean value. It is considered FALSE if it is 0 and TRUE otherwise. So, 2 would count as TRUE.

To be entirely clear, MySQL does not have a true BOOLEAN type. BOOLEAN is a synonym of TINYINT(1), as the docs explain:

BOOL, BOOLEAN

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

...

However, the values TRUE and FALSE are merely aliases for 1 and 0, respectively, as shown here:

...

Source Link
ypercubeᵀᴹ
  • 100k
  • 13
  • 217
  • 306
Loading