Get the App
SLTechnology News&Howtos  ›  Database  › 

What does null mean in mysql?

Shulou Source: shulou.com Published: 2022-06-01 02:56:08 10月03日 Update

The editor will share with you what null refers to in mysql. I hope you will gain a lot after reading this article. Let's discuss it together.

In mysql, null stands for nothing, is an undefined value, takes up space, but cannot participate in any calculation, because null values participate in any calculation is empty. Null makes indexes, index statistics, and values more complex, and affects the judgment of the optimizer.

Null in mysql is really difficult to deal with, and often many experts have been cheated by it during sql optimization.

In MySQL, null is unknown and takes up space. Null makes indexes, index statistics, and values more complex, and affects the judgment of the optimizer.

Null values ('') do not take up space, and note that there are no spaces between null values.

When count () counts the number of records in a column, the NULL value used will be automatically ignored by the system, but the null value will be counted into it.

It is determined that null uses is null or is not null, but empty characters are processed using =''or''.

For the timestamp data type, if you insert a NULL value, the value that appears is the current system time. Insert a null value and you will see '0000-00-0000: 00Remo00'.

For tables that have already been created, the performance improvement from changing null to not null for ordinary columns is relatively small, so there is no need to specifically find and null to modify not null one by one during tuning.

For tables that have been created, if you plan to create an index on the column, change it to not null as much as possible, and use 0 or a special value or null value''.

In summary, the advantages outweigh the disadvantages by specifying all tables as not null and specifying default''or other default values.

After reading this article, I believe you have a certain understanding of what null means in mysql. You want to know more about it. Welcome to follow the industry information channel. Thank you for your reading!

Tags: Indexes statistics space complexity articles systems built influence ordinary special difficult necessary between representatives strengths all weaknesses finished not yet performance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Huawei Linux Microsoft MariaDB