I have the following problem and I would like to know how to solve it creating a query on MySQL.
Check out those two tables:


I need to follow a structure to show the results I want. It is like a randon inside a randon. For example, I want to randomize each section, but ids 1 to 3 must be together and then randomize too.

How would be a query to get such results?