mysql ERROR 1364 (HY000): Field 'name' doesn't have a default value 怎么解决

mysql> create table Teachher(

    -> id int(4) primary key not null unique auto_increment,

    -> num int(10) not null unique,

    -> name varchar(20) not null,

    -> sex varchar(4) not null,

    -> birthday datetime,

    -> address varchar(59)

    -> );

Query OK, 0 rows affected (0.67 sec)


mysql> desc Teachher;

+----------+-------------+------+-----+---------+----------------+

| Field    | Type        | Null | Key | Default | Extra          |

+----------+-------------+------+-----+---------+----------------+

| id       | int(4)      | NO   | PRI | NULL    | auto_increment |

| num      | int(10)     | NO   | UNI | NULL    |                |

| name     | varchar(20) | NO   |     | NULL    |                |

| sex      | varchar(4)  | NO   |     | NULL    |                |

| birthday | datetime    | YES  |     | NULL    |                |

| address  | varchar(59) | YES  |     | NULL    |                |

+----------+-------------+------+-----+---------+----------------+

6 rows in set (0.01 sec)


mysql> insert into Teachher(num)

    -> values('2513');

ERROR 1364 (HY000): Field 'name' doesn't have a default value

mysql> insert into Teachher(num)

    -> values(2513);

ERROR 1364 (HY000): Field 'name' doesn't have a default value


qq_小杜_1
浏览 2324回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

MySQL