Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use tinyint

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report