· 6 years ago · Jun 18, 2019, 09:00 AM
1insert into test2 (id,test) values('','');
2
3id
4
5INSERT INTO test2 () VALUES (),(),();
6INSERT INTO test2 (test) VALUES (NULL),(NULL),(NULL);
7INSERT INTO test2 (id) VALUES (NULL),(NULL),(NULL);
8
9use test
10DROP TABLE IF EXISTS test2;
11CREATE TABLE test2
12(id int not null auto_increment primary key,
13test int not null default 0);
14SHOW CREATE TABLE test2G
15SELECT * FROM test2;
16
17mysql> use test
18Database changed
19mysql> DROP TABLE IF EXISTS test2;
20Query OK, 0 rows affected (0.11 sec)
21
22mysql> CREATE TABLE test2
23 -> (id int not null auto_increment primary key,
24 -> test int default 0);
25Query OK, 0 rows affected (0.34 sec)
26
27mysql> SHOW CREATE TABLE test2G
28*************************** 1. row ***************************
29 Table: test2
30Create Table: CREATE TABLE `test2` (
31 `id` int(11) NOT NULL AUTO_INCREMENT,
32 `test` int(11) NOT NULL DEFAULT '0',
33 PRIMARY KEY (`id`)
34) ENGINE=InnoDB DEFAULT CHARSET=latin1
351 row in set (0.00 sec)
36
37mysql> SELECT * FROM test2;
38Empty set (0.00 sec)
39
40mysql>
41
42mysql> SELECT * FROM test2;
43Empty set (0.00 sec)
44
45mysql> INSERT INTO test2 () VALUES (),(),();
46Query OK, 3 rows affected (0.03 sec)
47Records: 3 Duplicates: 0 Warnings: 0
48
49mysql> INSERT INTO test2 (test) VALUES (NULL),(NULL),(NULL);
50Query OK, 3 rows affected, 3 warnings (0.06 sec)
51Records: 3 Duplicates: 0 Warnings: 3
52
53mysql> INSERT INTO test2 (id) VALUES (NULL),(NULL),(NULL);
54Query OK, 3 rows affected (0.06 sec)
55Records: 3 Duplicates: 0 Warnings: 0
56
57mysql> SELECT * FROM test2;
58+----+------+
59| id | test |
60+----+------+
61| 1 | 0 |
62| 2 | 0 |
63| 3 | 0 |
64| 4 | 0 |
65| 5 | 0 |
66| 6 | 0 |
67| 7 | 0 |
68| 8 | 0 |
69| 9 | 0 |
70+----+------+
719 rows in set (0.00 sec)
72
73mysql>
74
75mysql> select * from information_schema.global_variables
76 -> where variable_name like 'version%';
77+-------------------------+------------------------------+
78| VARIABLE_NAME | VARIABLE_VALUE |
79+-------------------------+------------------------------+
80| VERSION_COMMENT | MySQL Community Server (GPL) |
81| VERSION_COMPILE_MACHINE | x86_64 |
82| VERSION_COMPILE_OS | Win64 |
83| VERSION | 5.6.15 |
84+-------------------------+------------------------------+
854 rows in set (0.07 sec)
86
87mysql>