|
Modify a column type :
The modify statement is also used to change the column type in a table, as the previous example. The below query will modify the column type.
mysql> alter table student modify name varchar(40);
Query OK, 0 rows affected (0.05 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> desc student;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| studid | int(10) | YES | | NULL | |
| name | varchar(40) | YES | | NULL | |
| marks | int(10) | YES | | NULL | |
| address | varchar(40) | YES | | NULL | |
| phone | int(10) | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
|