I want something to store an id list of another table in the database. But I do not know how to properly organize it. I understand that the type of the column should be Text, and when added, use a separator and somehow then divide this thing into these same id. Tell me who faced this.

  • one
    For example, the string type of the column and Id are stored, separated by a comma: "1,2,3,42" . When adding a value, id cast to a string, glued to a string with a separator,. And when pulling out, the reverse action is the separation of , and coercion of id to number is gil9red
  • How can a String like: "1, 2, 3, 4" be split into an array int [] {1,2,3,4}? - MediaPortal
  • String[] parts = string.split(", "); go through parts after the cycle, converting to number - gil9red
  • Thanks for the tip. - MediaPortal
  • The proposed solution is a notable crutch. There is such a discipline - the DBMS, if you want to work with the database "for an adult", you need to familiarize yourself with this science in general and with the organization of many-to-many communications in particular. For starters, I recommend reading L. Bailey's book "Learning SQL" . The book gives all the basic concepts of working with the database and is written very accessible to beginners. - pavlofff

0