Several conceptual questions about database field length bytes (byte) and (bit)! __ Database

Source: Internet
Author: User
The application base is also a long time, just a few conceptual problems have been entangled.    1, Bytes (byte) 2, Bit (bit) 3, storage Unit 4, byte and binary relationship, that is, byte and bit transformation relationship. It seems to look, in fact, is a concept inside the two different units, the standard unit value of the transformation between, the first thing to understand is whether bit or byte, are storage units, used to measure the storage capacity of units. Then look at the binary and bit relationships, in binary systems, each 0 or 1 is a bit. In a computer system, when data is stored in byte, the smallest unit of data storage is byte, which is irrelevant to the bit.    The data is transmitted mostly with bit, and one byte = 8 bits (bit).    The reason is very tangled is mainly about, a Chinese character, an English letter, a Chinese character symbol, an English symbol of the number of stations, a Chinese characters accounted for 2 bytes, an English letter accounted for 1 bytes without case. int stores values in the range of:-2 of 32 of the--2 32 times minus 1, (that is, all positive and negative integers between 247483648 and 147483647), so int is not required to specify the length of the number. explain the similarities and differences of char and nchar
First Char is known to have a maximum value of 8000, each byte is a storage unit, English and the value of only one storage unit, so char (10) can hold up to 10 English or digital, but Chinese is not the same, in some systems have each Chinese will occupy 4 storage units, so char (10 It is possible to hold 2 or 4 Chinese.
the maximum range for nchar is 4000, which is just half of char, and why 4000. Because nchar uses a standard, the name of the standard I forget, it stipulates that each storage unit is 2 bytes instead of 1 bytes per storage unit of Char. So nchar (10) can accommodate up to 10 digits or English letters or punctuation, while Chinese can accommodate 10 or 5 of the maximum, depending on the system.

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.