This week's book giveaway is in the Programmer Certification forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I'm trying to build my app database and I'm new to the DB world, so I have doubts about my ER model and it's relationships.
This is an app that connects to an API from Strava to check your bike workouts and track the life (durability) of your bike components depending on the Kilometers you have traveled.
The information I want to save is the Users and their Bikes (Only one, but maybe I'll permit more than 1 bike).
From Users, I want to store:
And from Bikes, I need to know if the bike is a Mountain Bike, if it has tubeless tires and if it's single chainring.
Also, the bike have diferent components, so I created a table for them (Chain, tyres, etc...). I need to know when was the last time the user set that component value to 0 (imagine the user replaces the chain, so he can reset to 0KM again.)
> component name
So I've thought in this ER diagram, but I don't know if the relationship between the tables Bike and Components should be n:m instead of 1:N. As I understand it, a Bike, can have a lot of components, but a component can only be of 1 bike. Or if the components tables has fixed values, each component can be assigned to a lot of bikes as well?
If the correct relationship is n:m should I create a linking table? I heared you need an extra table to link that n:m relationships.