How to change an existing column data type?

One of the columns in a somewhat large table (~ 10,000 records) refers to the DECIMAL data type (10.0). I am using MySQL.

I would like the values โ€‹โ€‹displayed in 2 decimal places, so I need to change this to DECIMAL (10,2) without twisting the table of existing entries. How can I do that?

+4
source share
1 answer

What DBMS are you using? you can try this for MySQL:

alter table tblName modify columnName newDataType; 
+8
source

Source: https://habr.com/ru/post/1383565/


All Articles