How you can store the list id in one line in MySQL?

Write your project and learn MySQL.
Using Eloquent ORM

There is a table table1:
id name
1 one
2 two
3 three
4 four


There is a table named table2 where each row stores a list of rows from table1, for example:
id table1_id
1 [3, 2, 4, 1]
2 [1, 2, 3, 4]
3 [4, 2, 1, 3]
4 [2, 4, 3, 1]


1. How to store this list, which would then quickly and tools to MySQL from table1 a list of the strings in table2?
2. Can I store these values in a string to an array of JSON, then in PHP to get this array and select from table1 with additional request? Or in MySQL there is a special type for such tasks?
3. Whether it is possible to store information in a MySQL database in JSON? How often do?
April 4th 20 at 00:42
1 answer
April 4th 20 at 00:44
Solution
Many to many relation

Find more questions by tags MySQL