I believe you refer to the correct tables?
The relationship between tables is one of the premises of a relational database (SQL), the construction of tables using relationships helps the location of records that have some reference to a particular record.
For example:
Imagine the situation of a sale, for example, if you do not use relationship between tables, your table venda
would have to have all the data pertinent to it, ie.
Imagine that Lucas salesman made 5 sales.
Quite simply, you'd have something like this:
Notethatifthesalespersonmakes1000salesforthesamecustomer,theinformationwillberepeated1000times,inadditiontoincreasingtheriskofinconsistentdata.(IcantypeLucasinonefield,Lucasinanother,Lucasdinanother)etc...
Forwhattherelationshipisfor.
Youassignanidentifierforeachrecord,andeverytimeyouuseit,youusethereferenceofthatrecord.
The id
field would be what we call the primary key, a unique identifier for that record (it does not have to be an integer, you can use any field or set of fields to identify a record)
When we point to a primary key that is in another table, this key is referred to as a foreign key, (for the sake of understanding, the relationship is usually created, and rules are assigned for that key foreign).
Well, by the way, I believe there's only sense in using a relational database if you're going to use relationships.
If your application does not need relationships, or you do not intend to use the relationships, I think it would be more advantageous to use non-relational (so-called NoSql) banks.