I'm not too familiar with database queries, but I would like to do the following: in a table, I have stored a column of tag ids like: [1,6,8] and I wish to return "Music, Dance, Pop" for example in my select query.
I did not design the database schema, and I'm not allowed to modify it.
The reason I would like to do so is the response of this query would be directly sent to the client for table rendering, and with the current ORM retrieval (PHP Laravel), this takes a long time retrieving the same related model for every row. So I would like to know if a query like this would be possible.
My schema looks something like this:
posts
id | name | ... | tag_ids (JSON array) | ...
tags
id | name
I have thought of using JSON_REPLACE, but have no idea on how to approach this problem at all. Is this even possible in plain SQL without code to post process the results?