Changes

Jump to: navigation, search

Updating and Deleting MySQL Tables

465 bytes added, 19:41, 2 October 2007
Changing The Data Type of a Column
=== Changing The Data Type of a Column ===
 
The current data type of a column may be changed using the ''ALTER TABLE'' statement in conjunction with the ''MODIFY'' keyword. The following example changes the data type of a column named ''prod_id'' from INT to TINYINT:
 
<pre>
ALTER TABLE products MODIFY prod_id TINYINT;
</pre>
 
Similarly, the following command increases the length of a column named ''prod_description'' to 20 characters:
 
<pre>
ALTER TABLE products MODIFY prod_description CHAR(20);
</pre>

Navigation menu