To create a table
|
1 2 3 4 5 6 7 |
create table expense( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, param varchar(50), value decimal(15,2), dt date, description varchar(20), primary key(id))ENGINE=InnoDB DEFAULT CHARSET=utf8; |
after creating table we want to increase the size of description field from varchar(20) to varchar(100).
for that we will use alter table command
Syntax
|
1 |
alter table expense modify description varchar(100); |
Example
|
1 |
alter table expense modify description varchar(100); |
we can also decrease the size of column but it may cause the data loss.
like
|
1 |
alter table expense modify description varchar(50); |