Can you set CHAR to NULL or an empty string?

I haven't used CHAR before, since it seems like I've used VARCHAR too often; I am trying to use CHAR when this comes up lately, and from what I understand you are using when the data is the same length in a specific column (otherwise they are filled with spaces).

Since all data should be the same length, I was wondering if the CHAR field could be NULL or an empty string? Such cases when this particular field does not matter while others do.

+3
source share
2 answers

Answer to your question (s): Yes.

Yes, the CHAR type can be NULLable. I believe that each type of column can be NULL.

, CHAR . , . , , ( ) , NULL.

CHAR VARCHAR MySQL ...

MySQL 5.0 - CHAR VARCHAR

+5

, NULL, . , , , , .

+2

All Articles