| Field | Type | Null | Key |Default | Extra |
+------------+--------------+------+-----+---------+-------+
| ID | int(11) | YES | | NULL | |
| NAME | varchar(200) | YES | | NULL | |
| GENDER | varchar(200) | YES | | NULL | |
| BIRTHDAY | date | YES | |NULL | |
| entry_date | date | YES | | NULL | |
| JOB | varchar(60) | YES | |NULL | |
| salary | float(8,2) | YES | |NULL | |
| resume | text | YES | |NULL | |
+------------+--------------+------+-----+---------+-------+
8 rows in set (0.01 sec)
mysql> alter table employee
-> to USER;
ERROR 1064 (42000): You have an error inyour SQL syntax; check the manual that
corresponds to your MySQL server versionfor the right syntax to use near 'to US
ER' at line 2
mysql> rename table employee
-> to USER;
Query OK, 0 rows affected (0.15 sec)
mysql> show tables;
+-----------------+
| Tables_in_mydb1 |
+-----------------+
| user |
+-----------------+
1 row in set (0.00 sec)
mysql> show create table user;
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----+
| Table | Create Table
|
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----+
| user | CREATE TABLE `user` (
`ID` int(11) DEFAULT NULL,
`NAME` varchar(200) DEFAULT NULL,
`GENDER` varchar(200) DEFAULT NULL,
`BIRTHDAY` date DEFAULT NULL,
`entry_date` date DEFAULT NULL,
`JOB` varchar(60) DEFAULT NULL,
`salary` float(8,2) DEFAULT NULL,
`resume` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
----+
1 row in set (0.00 sec)
mysql> alter table user character setutf8;
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> alter table user change nameusername varchar(100);
Query OK, 0 rows affected (0.07 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> insert into USER values(2,'wangdong','male','1990-09-08','2014-02-17','C
TO',100000,'strong man');
Query OK, 1 row affected (0.07 sec)
mysql> insert into USER values(1,'wangdongxue','male','1990-09-08','2014-02-17'
,'CTO',100000,'strong man');
Query OK, 1 row affected (0.05 sec)
mysql> insert into USER values(1,'wangdongxue','male','1990-09-08','2014-02-17'
,'CTO',100000,'strong man');
Query OK, 1 row affected (0.00 sec)
mysql> insert into USER values(1,'wangdongxue','male','1990-09-08','2014-02-17'
,'CTO',100000,'strong man');
Query OK, 1 row affected (0.07 sec)
mysql> select * from user;
+------+-------------+--------+------------+------------+------+-----------+-