mysql> create table users(num int not null, id varchar(30) not null, password varchar(30) not null, primary key(num));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into users values(1, 'admin', 'ad1234');
Query OK, 1 row affected (0.00 sec)
mysql> insert into users values(2, 'wh1ant', 'wh1234');
Query OK, 1 row affected (0.00 sec)
mysql> insert into users values(3, 'secuholic', 'se1234');
Query OK, 1 row affected (0.00 sec)
mysql> select * from users where id=0;
+-----+-----------+----------+
| num | id | password |
+-----+-----------+----------+
| 1 | admin | ad1234 |
| 2 | wh1ant | wh1234 |
| 3 | secuholic | se1234 |
+-----+-----------+----------+
3 rows in set, 3 warnings (0.00 sec)
mysql> show warnings
-> ;
+---------+------+-----------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'admin' |
| Warning | 1292 | Truncated incorrect DOUBLE value: 'wh1ant' |
| Warning | 1292 | Truncated incorrect DOUBLE value: 'secuholic' |
+---------+------+-----------------------------------------------+
3 rows in set (0.00 sec)
mysql> select * from users where id='0';
Empty set (0.00 sec)
mysql> select * from users where 0=id;
+-----+-----------+----------+
| num | id | password |
+-----+-----------+----------+
| 1 | admin | ad1234 |
| 2 | wh1ant | wh1234 |
| 3 | secuholic | se1234 |
+-----+-----------+----------+
3 rows in set, 3 warnings (0.00 sec)
mysql> insert into users values('ucjmh','ucjmh','ucjmh');
Query OK, 1 row affected, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+------------------------------------------------------------+
| Level | Code | Message |
+---------+------+------------------------------------------------------------+
| Warning | 1366 | Incorrect integer value: 'ucjmh' for column 'num' at row 1 |
+---------+------+------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> select * from users;
+-----+-----------+----------+
| num | id | password |
+-----+-----------+----------+
| 0 | ucjmh | ucjmh |
| 1 | admin | ad1234 |
| 2 | wh1ant | wh1234 |
| 3 | secuholic | se1234 |
+-----+-----------+----------+
4 rows in set (0.00 sec)
如果是在oracle中直接会报ora-01722