Is there any way to create a column of data type 'array' in mysql table ? like this below :
create table tb_name (
-> column_name INT ARRAY[1000] NOT NULL);
Is there any way to create a column of data type 'array' in mysql table ? like this below :
create table tb_name (
-> column_name INT ARRAY[1000] NOT NULL);
There is no data type to store an array in MySQL.
but you can convert your array to JSON and store it in the table and convert it back to an array when you need it.
Also, you can create a multiple tables to store your array of data.
Your main table,
CREATE TABLE tb_name (
`id` INT NOT NULL PRIMARY KEY,
`column_name` VARCHAR(100),
`column_name` VARCHAR(100)
);
Your array data table
CREATE TABLE array_data (
`id` INT NOT NULL PRIMARY KEY,
`pf_tb_table` INT NOT NULL,
`array_index` INT,
`array_data` VARCHAR(100),
FOREIGN KEY (pf_tb_table) REFERENCES tb_name (id),
);