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.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How to create a good ER diagram about a Bike Component Life Viewer scenario

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
> ID
> Name
> Surname

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.
> ID
> isSingleChainRing
> isTubeless
> isMTB

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.)
> ID
> component name
> last_reset

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.

Thanks for your help.
No more fooling around. Read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!