
 
 
 
mysql> create table employee( id int primary key, name varchar(50), gender enum('男','女') default '男', salary int  );
Query OK, 0 rows affected (0.01 sec)
mysql> 
mysql> desc employee;
+--------+-------------------+------+-----+---------+-------+
| Field  | Type              | Null | Key | Default | Extra |
+--------+-------------------+------+-----+---------+-------+
| id     | int(11)           | NO   | PRI | NULL    |       |
| name   | varchar(50)       | YES  |     | NULL    |       |
| gender | enum('男','女')   | YES  |     | 男      |       |
| salary | int(11)           | YES  |     | NULL    |       |
+--------+-------------------+------+-----+---------+-------+
4 rows in set (0.01 sec)
#插入数据
mysql> insert into employee
    -> values(1,'张三','男',2000)
    -> ;
Query OK, 1 row affected (0.01 sec)
mysql> insert into employee values(2,'李四','男',1000),(3,'王五','女',4000);
Query OK, 2 rows affected (0.00 sec)
mysql> select * from employee;
+----+--------+--------+--------+
| id | name   | gender | salary |
+----+--------+--------+--------+
|  1 | 张三   | 男     |   2000 |
|  2 | 李四   | 男     |   1000 |
|  3 | 王五   | 女     |   4000 |
+----+--------+--------+--------+
3 rows in set (0.00 sec)
#更新数据
mysql> update employee set salary=5000;
mysql> update employee set salary=3000 where name='张三';
mysql> update employee set salary=4000,gender='女' where name='李四';
mysql> update employee set salary=salary+1000 where name='王五';
mysql> select * from employee;
+----+--------+--------+--------+
| id | name   | gender | salary |
+----+--------+--------+--------+
|  1 | 张三   | 男     |   3000 |
|  2 | 李四   | 女     |   4000 |
|  3 | 王五   | 女     |   6000 |
+----+--------+--------+--------+
3 rows in set (0.00 sec)