SQLServer field type _ MySQL

Source: Internet
Author: User
First class: integer data bit: bit data type represents 0, 1 or NULL, that is, true, false. 1byte.int: 4 bytes are used to store positive and negative numbers. the storage range is-2 ^ 31 to 2 ^ 31-1.smallint. positive and negative values are stored in 2 bytes. storage range:-2 ^ 15 to 2 ^ 15-1tiny first class: integer data

Bit: the bit data type is 0, 1 or NULL, which indicates true or false. occupies 1 byte. int: stores positive and negative numbers in four bytes. the storage range is-2 ^ 31 to 2 ^ 31-1. smallint: stores positive and negative numbers in two bytes. storage range:-2 ^ 15 to 2 ^ 15-1 tinyint: the smallest integer type, only 1 byte, range: 0 so far ^ 8-1

Second Category: Exact value data

Numeric: The number can reach 38 bits. the number of bytes used for data storage varies with the number of bits used for data use. decimal: Similar to numeric.

Category 3: approximate floating point data

Float: uses 8 bytes to store data. A maximum of 53 characters can be entered. the range is-1.79E + 308 to 1.79E + 308. real: The number of digits is 24. The value ranges from-3.04E + 38 to 3.04E + 38.

Category 4: Date and time data

Datatime: The time range can be 1753/1/1 to 9999/12/31, and the time can be 3.33/1000 s. 8 bytes. smalldatetime: indicates that the time range can be from to 2079/12/31. 4 bytes.

Category 5: string data

Char: The length is set. the shortest is 1 byte and the longest is 8000 bytes. the length is left blank. varchar: The length is also set. the shortest value is 1 byte and the maximum value is 8000 bytes. the white space at the end is removed. text: the length and width are also set. up to 2 GB data can be stored.

Category 6: Unincode string data

Nchar: The length is set. the shortest is 1 byte and the longest is 4000 bytes. the length is left blank. it takes 2 bytes to store a character. nvarchar: the maximum length is 1 byte and 4000 bytes. the white space at the end is removed. it takes 2 bytes to store a character. ntext: The length is set. the shortest is 1 byte and the longest is 2 GB. the white space at the end is removed. it takes 2 bytes to store a character.

Category 7: currency data type

Money: The record amount range is-92233720368577.5808 to 92233720368577. 5807. 8 bytes are required. smallmoney: the record amount range is-214748.3648 to 214748. 36487. 4 bytes are required.

Category 8: Mark data

Timestamp: This data type is unique in each table! When a record changes in a table, the timestamp field of the record is automatically updated. uniqueidentifier: used to identify the unique record of many tables in the database.

Category 9: binary string data

Binary: a fixed-length binary string field. the minimum length is 1 and the maximum length is 8000. varbinary: when the tail of the data is 00, varbinary removes the image from it: a variable-length binary code string. The maximum length is 2 GB.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.