mariadb change column to primary key code example

Example 1: mariadb change column type

ALTER TABLE Schema.TableName
  CHANGE COLUMN CurrentTableName NewTableName MEDIUMTEXT DEFAULT NULL COMMENT '(DC2Type:json_array)';

Example 2: mariadb alter table modify column

ALTER TABLE clients
CHANGE address address1 varchar(40),
MODIFY active enum('yes','no','AC','IA');

UPDATE clients
SET active = 'yes'
WHERE active = 'AC';

UPDATE clients
SET active = 'no'
WHERE active = 'IA';

ALTER TABLE clients
MODIFY active enum('yes','no');

Tags:

Sql Example