Home > Common Problem > What are the common data types of data tables?

What are the common data types of data tables?

青灯夜游
Release: 2019-02-27 09:03:50
Original
23427 people have browsed it

Common data types of data tables include: integer type, floating point type, date and time type, string type, binary type, and Boolean type.

What are the common data types of data tables?

Integer type:

1. Int type: is an integer composed of four bytes , output range (-2147483 648~2 147 483 647)

2. bigint type: an integer composed of eight bytes, output range (-9,223,372,036,854,775,808~9 223 372 036 854 775 807)

3. Tinyint type: Only integers between (0~225) can be input

4. Smallint type: It is an integer composed of two bytes, and the output range is (-32768~32767)

Floating point type:

3. float: represents single-precision floating point value

2. double: represents double Precision floating point value

String type:

1, charchar (n): fixed length, up to 255 characters

2. varchar(n): fixed length, up to 65535 characters

3. text: variable length, up to 65535 characters

4. tinytext: variable length, up to 255 characters

5, mediumtext: variable length, up to 2 to the 24th power - 1 character

6, longtext: variable length, up to 2 to the 32nd power - 1 character

Binary type:

varbinary(max), binary(max)

Boolean type :

Sometimes you just need to store something that is "yes" or "is not". It can be set to Boolean type.

boolean: There are three states: 1 (indicating TRUE), 0 (indicating FALSE) or NULL.

Date and time types:

1. Data type: represents date value, format is (YYYY-MM-DD), range ( 1000.1.1~9999.12.31)

2. Datatime type: represents mixed date and time values, the format is (YYYY-MM-DD HH:MM:SS), the range is (1000.1.1 00:00: 00~9999.12.31 23:59:59)

3. Time type: represents a more precise time value or duration, the format is (HH:MM:SS), the range is (-838:59:59' ~'838:59:59')

4. Year type: represents the year value, the format is (YYYY), range (1901~2155)

5. Timestamp type: automatically stores records Modification time (if there is a timestamp data type in the database, time zone issues should be considered)

The above is the entire content of this article, I hope it will be helpful to everyone's learning. For more exciting content, you can pay attention to the relevant tutorial columns of the PHP Chinese website! ! !

The above is the detailed content of What are the common data types of data tables?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template