1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
create table t1 (a int, b int not null, c int null, d int not null, pk int primary key);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` INT DEFAULT NULL,
`b` INT NOT NULL,
`c` INT DEFAULT NULL,
`d` INT NOT NULL,
`pk` INT NOT NULL,
PRIMARY KEY (`pk`)
) ENGINE=InnoDB COLLATE = utf8_general_ci
insert into t1 values (0,0, 0, 0,0);
insert into t1 values (NULL, NULL, NULL, NULL, 1);
ERROR 23000: Column 'b' cannot be null
insert into t1 values (NULL, 1, NULL, 1, 2);
insert into t1 values (1,2,3,NULL, 3);
ERROR 23000: Column 'd' cannot be null
drop table t1;
|