Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert from 'float' to 'int'?

I have a table with more than 1 million records, in 2 columns with datatype varchar(50) I have values like 23.23.

I need to convert the data/values to int. For Example, 23.23 to 23 by remove the floating points.

I don't have primary key on this table.

like image 733
Muhammad Avatar asked Dec 25 '22 11:12

Muhammad


1 Answers

ALTER TABLE t1 CHANGE <column_name> <column_name> <type> 

note: you have to write column name twice OR

ALTER TABLE t1 MODIFY <column_name> <type> ;

Reference

like image 90
Vignesh Kumar A Avatar answered Jan 04 '23 02:01

Vignesh Kumar A