I
I
Intelix2019-05-12 11:23:28
Database design
Intelix, 2019-05-12 11:23:28

What is this attitude?

I have a users table and the users_progress table
users contains fields (full name, login, password) that should not change
users_progress contains fields (level and the like) that are constantly changing The
question is, what kind of relationship is this: one to one or one to many or in general Shouldn't you bother and merge these tables?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-05-12
@Intelix

If each user can only have one level, then it is one to one . If a user can have multiple levels, then one to many . In the second case, it is necessary to separate exactly. The first depends on the nuances of a particular system. For example, the degree of logical connectivity of data - how much the data in the table usersmakes sense without the data in the table users_progress. Or the nature of working with data: if data from both tables is never selected without each other, then you will have some resources spent on unnecessary joins , but if some of the selections use only data from users, and some only from users_progress, then finding them will already waste resources in one table.

D
d-stream, 2019-05-12
@d-stream

Well, for starters, it’s worth voicing the structure of the tables. In this case, primary keys are sufficient. This will immediately answer the question.
Well, yes, for the future: full name - can change, login - actually too, and only the password ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question