When a field in the database is set to Null, Mobile client will return Null by default. If I want Mobile client to return NULL, I have to make a judgment.
1. If I want Mobile client to return empty, how should I set the table field default without judgment?
2. Is it better to set default to Null for the table field, or” or Empty String? Are they different?
1: Null value (”) does not take up space
2: NULL in MySQL actually takes up space. Official documentation:
“NULL columns require additional space in the row to record whether their values are NULL. For MyISAM tables, each NULL column takes one bit extra, rounded up to the nearest byte.”
Therefore, mysql does not recommend default NULL when designing tables
String can be defaulted” int can be default 0
If you want to judge whether the field is empty, use php to process it.