Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (6.1k points)

In MySQL, I have a column that is presently in varchar(100) type and I need to make it 10000.

Is it as easy like:

alter table table_name set column col_name varchar (10000);

I am scared to corrupt the existing data. Will it be ok if I execute this query? Or should I do alter the column another way?

1 Answer

0 votes
by (12.7k points)
edited by

I usually use this following statement:

ALTER TABLE `table_name`
  CHANGE COLUMN `col_name` `col_name` VARCHAR(10000);

However, I think SET will work also, never have tried it. Do check it once.

Are you looking for a good SQL tutorial? Join the Intellipaat's SQL course now and gain more knowledge in SQL.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 22, 2020 in SQL by Appu (6.1k points)

Browse Categories

...