Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change mariadb column type from varchar to blob

Tags:

sql

mariadb

How to change mariadb column type from varchar to blob or varchar2(500)

like image 409
maya16 Avatar asked Mar 23 '17 09:03

maya16


People also ask

How do I change the datatype of a column in MariaDB?

The syntax to modify a column in a table in MariaDB (using the ALTER TABLE statement) is: ALTER TABLE table_name MODIFY column_name column_definition [ FIRST | AFTER column_name ]; table_name. The name of the table to modify.

Can we change the datatype of a column in MySQL?

SQL query to change the column type in MySQL Server. We can use ALTER TABLE MODIFY COLUMN statement to change the datatype of the column. The syntax to change the datatype of the column is following.

How do you change the datatype of a field?

Change data types in Datasheet view Select the field (the column) that you want to change. On the Fields tab, in the Properties group, click the arrow in the drop-down list next to Data Type, and then select a data type. Save your changes.

How do I change the default value of a column in MariaDB?

A column's default value is part of its definition, but can be modified separately from other aspects of the definition. To change a default value, use ALTER col_name SET DEFAULT : ALTER TABLE mytbl ALTER j SET DEFAULT 1000; Default values must be constants.


1 Answers

You need an alter table query

ALTER TABLE table_name
MODIFY column_name column_definition

Example:

ALTER TABLE websites
MODIFY host_name varchar(50);
like image 157
osanger Avatar answered Sep 29 '22 21:09

osanger