The little things found during program tuning today.
In Windows, if the key value is default null and ''is inserted, an error occurs.
If mysql is running in Linux, the value of 0 in the same table is as follows:
The table creation statement is the same. Create a table under win and Linux.
Create table test (
A int (11 ),
B char (11 ),
C varchar (20 ));
Run the following statement and corresponding results in window:
Mysql> insert into test set a = '';
ERROR 1366 (HY000): Incorrect integer value: ''for column 'A' at row 1
Mysql> insert into test set a = 'a ';
ERROR 1366 (HY000): Incorrect integer value: 'A' for column 'A' at row 1
Mysql> insert into test set a = '1 ';
Query OK, 1 row affected (0.02 sec)
Mysql> select * from test;
+ ------ +
| A | B | c |
+ ------ +
| 1 | NULL |
+ ------ +
Run the following statement and corresponding results in Linux:
Mysql> insert into test set a = '';
Query OK, 1 row affected, 1 warning (0.00 sec)
Mysql> insert into test set a = 'a ';
Query OK, 1 row affected, 1 warning (0.00 sec)
Mysql> select * from test;
+ ------ +
| A | B | c |
+ ------ +
| 0 | NULL |
| 0 | NULL |
+ ------ +
It is found that in Windows, data cannot be inserted if it does not conform to the int type. in Linux, it is converted to 0 for storage.
Execute select * from Test and select * from TEsT under Widnows to retrieve data from the test table.
In Linux, the system will prompt that Test or TEsT Linux cannot be found, which is case sensitive.