I have two tables A and B.
In table A, it contains two cols, A1,A2 where A1 is primary key
In table B, one of the column, let says B2, store an array of value in col A1
I want to reference every element in this array to col A1 in table A. Is this possbile
For example,
table A
ID|name|value
1|OTZ|10
2|hello world 10
3|apple|2
4|orange|5
table B
id|array
1|1,2
2|3,4
3|1,4
How can I reference those value in col array to table A?
As you asked for, a short answer – this is how you solve a “many to many” relation between two tables.
Many to Many can also mean, that one entry in Table A has no connection to TABLE B at all, or it has hundres (and vice verca)
If you got
if you want to save a relation between those two, you will need a mapping-table, most of the time called TABLEA2B (or something like that) which holds at minimum the both primary key of those tables as a combined primary key (so that the same combination is not allowed twice)
A article about that with an UML diagram and complete (working) SQL Example codes can be found here: http://sqlrelationship.com/many-to-many-relationship/