Change field definition --alter table change column statement

Use the "alter table change column statement" to change the field definition.

alter table table name change column field name to be changed field name after change field definition

Field definitions can specify data types, NULL constraints, default values, and so on.

This is a sample of "alter table change column statement".

alter table book change column author author varchar (150) not null defatul'';

Is it possible to change only the field name with the alter table change column statement?

You cannot change just the field names in MariaDB. Even if you only change the field name, you still need to write the field definition.

"alter table change column statement" is slow when there are many rows

It is unavoidable that the "alter table change column statement" is slow when there are many rows.

MariaDB will create a temporary table, copy it to it, and change the field definition so that it doesn't affect the current process, so wait.

This can happen, so it's a good idea to have a good database table design if you know that the amount of data is small or large from the beginning.

Associated Information