I am making a database project using Spring Boot and I have a model in mind that utilizes multiple tables. In this model of mine I thought about having a main table and using some of the attributes of this table as a primary key for the others, but I don't want to store, say, lists of others tables inside as seems to be the case for people when they use the @OneToMany tag and others. As you may guess, I'm new to database design.
Below, there is a simplified scheme of what I want to do.
My main questions here are:
Thank you in advance.
Person and Mobile number is the best example for one-to-many relationship. Because one person can have multiple mobile numbers, and for the mobile number perspective multiple mobile numbers refers to one person.
For the person entity there will be field like below: id, name, city, mobile_number_id [foreign key] which will holds id from mobile entity
For the mobile entity there will be field like below: id, mobile_number
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.