can one to one,many-one mapping be using 1 table.only one-many,many-many requires multiple tables
posted 2 years ago
Please confirm whether my understanding is correct:
one to one mapping: No need for creating more than 1 table. Only in one table it can be shown.
E.g Customer ,Mobile number ........in customer table we can have mobile number.
---One table was involved.
many to one mapping: Again no need for separate tables.just create only 1 table
E.g Customer, Country--------in customer table we can have countryID entry.
---two tables were involved.
one to many: we need separate tables.
E.g Customer,Email.....In Email table we can have customer ID
---2 tables were involved.
many to many: we need separate tables.
So is my conclusion correct that one to one can be shown using just 1 table.but one to many and many to many and many to one can requires separate tables.
In my understanding mapping is linking two or more tables via foreign and primary keys.
One-to-one means link one primary key in one table to one foreign key in another table.
One-to-many means link one primary key in one table to many foreign keys in another table.
Many-to-one link many foreign keys to one primary key.
To understand all this it is beter to see it once in action!