Database Design 1 to 1

I am creating my database incorrectly, should I fix it while it is under development?

"user" table should be related 1.1 to the table "userprofile"

     

however, the actual design of the user table is 1. * related to the userprofile table.

Everything is working! but should it be fixed anyway?

+3
source share
5 answers

Do one thing

User Table 
   Userid(p)
   UserName
   othercol..

UserProfile 
   id(p)
   UserId(f) - and unique
   othercol..

hope you can easily fix isse

+3
source

Make user_id in the user_profile table unique and fixed.

+2
source

1:1, "user" "userprofile" , .

+2

, FK. , , , , , , , .

, , , . . , , , , , .. , . , , . , .

+1

@pranay

User Table 
   Userid(p)
   UserName
   othercol..

UserProfile 
   id(p)
   UserId(f) - and unique
   othercol..

, ()? ()?

User Table 
   Userid(p)
   UserName
   othercol..

UserProfile 
   id(p) <--- userid
   othercol..
0

Source: https://habr.com/ru/post/1744446/


All Articles