Can you store arrays within tables in MySQL?

Can you? If so, how?
So far, I have something like this



CREATE TABLE test_table
(
name varchar(255),
owner varchar(255),
members array,
);


But MySQL doesn’t recognize that datatype.

I was also considering making a giant string and having commas as separators, but I’m unsure of the hard-coded character limit in MySQL.

Any help would appreciated!

What are you trying to put in it? The point of MySQL is to use the tables as sort of arrays, so you can quickly access a specific row without writing code to loop through every row.

Basically, I want to have a table containing some “groups”. the “members” are a list of steam IDs.
Again, I considered doing something like “STEAM_0:1:234567,STEAM_0:0:165343,STEAM_0:1:337” ect. But again, I’m not sure of how long I CAN make a string in MySQL.

Why not make first column as steamid ans second column as user group?

Interesting idea, but this is kind of like a “club” system where a player can be members of multiple groups. That’s why, in the “club” data, I want to list all the members. What I showed above is not all the data contained within the main table.

You could select multiple rows where steamid equals to the one in question.

I don’t understand, what do you mean?

I’d go with two (or more tables) and use JOINs to get the data together. Have a table for clubs with their name and clubid (something unique). Have a table for players with their name and playerid (SteamID?). Then have a table that contains a clubid and playerid, thus linking them together. You can add players to a club by making a new entry with their playerid and clubid, or remove them from the club by removing the row from the table.

You can select multiple rows with MySQL. If there’s 100 rows that have SteamID column set to “BOT”, and you select all rows with SteamID=“BOT”, it will return you all the 100 rows.

You should use json to store it as a string make sure you escape the string. And if you store your table as a json string you can read the json string back and have it rebuild the table as it was constructed before.

Nevermind, I found a work-around.