content_image/689918.jpg content_image/689919.jpg content_image/689920.jpg
mysql> SELECT IF(1 = TRUE, ’true’, ’false’); 

<img src='content_image/689918.jpg'>

mysql> SELECT IF(2 = TRUE, ’true’, ’false’); 

<img src='content_image/689919.jpg'>

mysql> SELECT IF(2 = FALSE, ’true’, ’false’); 

<img src='content_image/689920.jpg'>

The last two statements display the results shown because 2  is equal to neither 1  nor 0 . 

• SMALLINT[( M )] [UNSIGNED] [ZEROFILL] 

A small integer. The signed range is -32768  to 32767 . The unsigned range is 0  to 65535 . 

• MEDIUMINT[( M )] [UNSIGNED] [ZEROFILL] 

A medium-sized integer. The signed range is -8388608  to 8388607 . The unsigned range is 0  to 16777215 . 

• INT[( M )] [UNSIGNED] [ZEROFILL] 

A normal-size integer. The signed range is -2147483648  to 2147483647 . The unsigned range is 0  to 4294967295 . 

• INTEGER[( M )] [UNSIGNED] [ZEROFILL] 

This type is a synonym for INT . 

• BIGINT[( M )] [UNSIGNED] [ZEROFILL] 

A large integer. The signed range is -9223372036854775808  to 9223372036854775807 . The unsigned range is 0  to 18446744073709551615 . 

SERIAL  is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE . 

Some things you should be aware of with respect to BIGINT  columns: 

• All arithmetic is done using signed BIGINT  or DOUBLE  values, so you should not use unsigned big integers larger than 9223372036854775807  (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE . 

MySQL can handle BIGINT  in the following cases: 

•When using integers to store large unsigned values in a BIGINT  column. 

•In MIN( col_name )  or MAX( col_name ) , where col_name  refers to a BIGINT  column. 

