char,varchar,nchar数据类型之间的主要区别是什么? [英] what is main differnce detween char,varchar,nchar datatype?

查看:146
本文介绍了char,varchar,nchar数据类型之间的主要区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

char,varchar,nchar数据类型之间的主要区别是什么?

what is main differnce detween char,varchar,nchar datatype?

推荐答案

1。单字节或双字节存储(ASCII或Unicode)

CHAR以单字节格式存储值(一个字节为一个字节),不能在多语言环境中使用...

N CHAR以双字节格式存储值(一个字符为两个字节)并支持任何UTF-8(Unicode)编码,因此可用于任何语言...

2.固定或可变长度

CHAR( n )具有固定大小的 n 字节存储空间,甚至较短的值将占用所有空间...

VAR CHAR( n )具有可变大小,具体取决于值的实际大小,其中 n 定义最大大小,最小值为0 ...有一个特定的大小指示符(自SQL 2008起) - MAX,它不标识值的最大长度...
1. Single-byte or double-byte storage (ASCII or Unicode)
CHAR stores the value in single-byte format (one byte for one char) and cannot be used in multilingual environments...
NCHAR stores the value in double-byte format (two bytes for one char) and supports any UTF-8 (Unicode) encoding, so can be used for any language...
2. Fixed or variable length
CHAR(n) has a fixed size of n byte storage, even shorter value will take all the space...
VARCHAR(n) has a variable size depending on the actual size of value, where n defines the maximum size, the minimum is 0...There is a specific size indicator (since SQL 2008) - MAX, that identifies no maximum length for the value...


这篇关于char,varchar,nchar数据类型之间的主要区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆