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
相关分类