How to rename a column name in maria DB
Table names, column names, etc, may need quoting with backticks, but not with apostrophes ('
) or double quotes ("
).
ALTER TABLE subject
CHANGE COLUMN `course_number` -- old name; notice optional backticks
course_id -- new name
varchar(255); -- must include all the datatype info
alter table "table_name" change column "old_name" "New_name" "datatype"*;
there is no need to use "TO" between old_name & New_name , datatype of New_name is must
e.g. -
alter table student change column id roll_no int;
Starting with MariaDB 10.5.2 you should be able to do
ALTER TABLE subject RENAME COLUMN course_number TO course_id;
see https://mariadb.com/kb/en/alter-table/#rename-column