Answer the question
In order to leave comments, you need to log in
How to design a table with a dynamic set of columns?
Help to design the elementary DB please. There is a task to create a multi-user service for recording runners' training in the form of a table.
The table will consist of a mandatory "date" column and a set of columns like: "workout duration, min", "distance, m", "average heart rate, bpm", etc. The number of columns and their names are determined by the user through the UI while working with the service.
I decided to use a relational database like mysql with tables like this:
1. Users:
- primary_key number,
- fname: string,
- lname: string,
- login: string,
- pass_hash: string,
- reg_date_unixstamp: number
2. Columns:
- primary_key: number,
- title: string,
- id_user: foreign_key
3. Values:
- primary_key: number,
- value: string,
- last_update_unixstamp: number,
- id_column: foreign_key,
- id_user: foreign_key
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question