Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use tinyint

Shulou Source: shulou.com Published: 2022-06-03 11:01:37 11月15日 Update

Editor to share with you how to use tinyint, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

In computer science, TINYINT is the data of integer data type, which represents a certain range of mathematical integers. Credit data types can be of different sizes and may or may not contain negative values. Integers are usually represented as a set of binary digits (bits) in a computer.

About tinyint ()

CREATETABLE`test` (

`id`int (11) NOTNULLAUTO_INCREMENT

`str`varchar (255) NOTNULL

`state`tinyint (1) unsignedzerofillDEFAULTNULL

`state2`tinyint (2) unsignedzerofillDEFAULTNULL

`state3`tinyint (3) unsignedzerofillDEFAULTNULL

`state4`tinyint (4) unsignedzerofillDEFAULTNULL

`state5`tinyint (1) DEFAULTNULL

`state6`tinyint (2) DEFAULTNULL

`state7`tinyint (3) DEFAULTNULL

`state8`tinyint (4) DEFAULTNULL

PRIMARYKEY (`id`)

) ENGINE=MyISAMAUTO_INCREMENT=6DEFAULTCHARSET=utf8

Result

It seems that tinyint (1), tinyint (2), tinyint (3), tinyint (4) are no different in the database.

Unsigned: maximum value 255, minimum value 0

Signed: maximum value 127, minimum value-128

About tinyint (1) of boolean:

Create the table test2:

CREATETABLE`test2` (

`id`int (11) NOTNULLAUTO_INCREMENT

`str`varchar (255) NOTNULL

`state`tinyint (1) DEFAULTNULL

`statebl`booleanDEFAULTNULL

PRIMARYKEY (`id`)

)

The above is all the contents of this article "how to use tinyint". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Data integers articles types maximum minimum content maximum symbols computers different nothing not much middle table binary size most numbers mathematics database Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Microsoft NVidia Docker