Differences between char, varchar, varchar2, nvarchar, and nvarchar2

Source: Internet
Author: User

1. the char length is fixed, while the varchar2 length can be changed.
2. Char is more efficient than varchar2.

Comparison:
Varchar2 saves space than char, and is slightly less efficient than Char. That is, to achieve efficiency, a certain amount of space must be sacrificed, this is what we often say in database design, "Change space for efficiency '. Although varchar2 saves space than char, if a varchar2 column is often modified and the length of the data to be modified is different each time, this will cause row migration, this causes redundant I/O, which should be avoided during database design and adjustment. In this case, it would be better to replace varchar2 with Char.

The difference between varchar and varchar2 is that the latter occupies two bytes of all characters. The former only occupies two bytes of Chinese characters and full-angle characters.
The difference between nvarchar and nvarchar2 is the same as above. The difference is the type defined according to the Unicode standard. It is usually used to support the definition of a system similar to a multi-country language.

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.