在MySQL中對表創建的char、varchar列選擇長度時,當使用例如varchar(20)時,在5.0.3版本后表示20個字符。當使用例如varchar(0)時,在MySQL官方參考手冊中是這樣寫的:
MySQL permits you to create a column of type CHAR(0). This is useful primarily when you must be compliant with old applications that depend on the existence of a column but that do not actually use its value. CHAR(0) is also quite nice when you need a column that can take only two values: A column that is defined as CHAR(0) NULL occupies only one bit and can take only the values NULL and '' (the empty string).
大致意思是長度為零的char或varchar表示該列用來兼容舊應用(無須更改業務代碼),可以為NULL或者''只需1bit存儲。
