Talking about the problem that MySQL databases contain zero values in China and Japan, mysql zero value
By default, MySQL can insert 0 values into a date. In reality, 0 values in a date are meaningless. You can adjust the SQL _mode variable of MySQL to achieve the goal.
set @@global.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION';set @@session.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION';
Example:
There is a table for logging
create table app_logs(id int not null auto_increment primary key,log_tm timestamp not null,log_info varchar(64) not null)engine=innodb,charset=utf8;
Insert interesting date values to the log table
insert into app_logs(log_tm,log_info) values(now(),'log_info_1');insert into app_logs(log_tm,log_info) values('2016-12-01','log_info_2');
Insert a date value containing 0 to the log table
insert into app_logs(log_tm,log_info) values('2016-12-00','log_info_2');ERROR 1292 (22007): Incorrect datetime value: '2016-12-00' for column 'log_tm' at row 1
The above discussion about the zero value in the MySQL database in China and Japan is all the content that I have shared with you. I hope to give you a reference and support for the customer's house.