The Dynamic columns feature was introduced in MariaDB 5.3.
COLUMN_CREATE(column_nr, value [as type], [column_nr, value [as type]]...); COLUMN_CREATE(column_name, value [as type], [column_name, value [as type]]...);
Returns a dynamic columns blob that stores the specified columns with values.
The return value is suitable for
The as type
part allows one to specify the value type. In most cases, this is redundant because MariaDB will be able to deduce the type of the value. Explicit type specification may be needed when the type of the value is not apparent. For example, a literal '2012-12-01'
has a CHAR type by default, one will need to specify '2012-12-01' AS DATE
to have it stored as a date. See Dynamic Columns:Datatypes for further details.
-- MariaDB 5.3+: INSERT INTO tbl SET dyncol_blob=COLUMN_CREATE(1 /*column id*/, "value"); -- MariaDB 10.0.1+: INSERT INTO tbl SET dyncol_blob=COLUMN_CREATE("column_name", "value");
© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/column_create/