Hii,

I am new to database thing so I am trying to wrap my head around it.

  1. many2one: so in this relationship you will have more than one record in one table which matches to only one record in another table. something like A <-- B. where (<–) is foreign key relationship. so B will have a column which will be mapped to more than one record of A.

  2. one2many: same as many2one but instead now the foreign key constrain will look something like A --> B.

  3. many2many: this one is interesting because this relationship doesn’t make use of foreign key directly. to have this relationship between A and B you have to make a third database something like AB_rel. AB_rel will hold values of primary key of A and also primary key of B. so that way we can map those two using AB_rel table.

tell me if I got something wrong :) give me some suggestion <3

  • Barbarian@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    5 months ago

    to have this relationship between A and B you have to make a third database

    Probably just a mistake here, but you make a third table, not a new database.

    Apart from that (and the fact that one to many and many to one is the same thing), yeah, looks correct.