Relationships happen between two tables.
One to Many means that one objects (called tuples, or rows) of Table A is related to one or more objects in Table B.
For example, if a doctor can work only in one hospital, and we have a table of hospitals and a table of doctors, Hospitals has a One to Many relationship with Doctors, because for each hospital you will have one or more doctors working at it.
Many to Many means that for each object in Table A, one or more objects in Table B are associated, and viceversa.
In the example, if doctors are allowed to work in different hospitals, the table Hospitals and the table Doctors have a Many to Many relationship.
Now, how to implement this in a relationship DB, that is another question.
Chat with our AI personalities
one-to-many relationship
A one-to-many relationship means that one row in one of the tables will relate directly to many rows in the other table.
Relation is one record in the database or a tuple. Relationship is that how tables are connected to each other.
The way a many to many relationship is done is by inserting a junction table and having two one to many relationships with the primary key of each of the two main tables becoming a join primary key of the junction table.
Tables are the basic building blocks of a relational database.