skip to Main Content
ALTER TABLE departments
RENAME COLUMN department_name TO dept_name VARCHAR(50);

Why I am getting this errorenter image description here

3

Answers


  1. could be you need CHANGE

    ALTER TABLE departments CHANGE department_name  dept_name VARCHAR(50); 
    

    or only RENAME

     ALTER TABLE departments
     RENAME COLUMN department_name TO dept_name ;
    
    Login or Signup to reply.
  2. Oh hello, why don’t you try this instead:

    ALTER TABLE table CHANGE actualName newName

    good luck have fun coding

    Login or Signup to reply.
  3. It depends on your version of MariaDB.

    Try this query :

    ALTER TABLE departments CHANGE COLUMN department_name dept_name VARCHAR(50);
    

    Look here :

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search