数据库设计1到1关系 [英] Database design 1 to 1 relationship

查看:142
本文介绍了数据库设计1到1关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



user表假设与userprofile表具有1.1关系



但是实际设计中的user表与userprofile表具有1. *关系。 / p>


一切正常!但是应该固定吗?

解决方案

做一件事

 用户表
Userid(p)
用户名
othercol ..

UserProfile
id(p)
UserId(f) - 和唯一
othercol ..

希望这样你可以轻松修复isse


I design my database incorrectly, should I fix this while its in development?

"user" table is suppose to have a 1.1 relationship with "userprofile" table

however the actual design the "user" table has a 1.* relationship with "userprofile" table.

Everything works! but should it be fixed anyways?

解决方案

Do one thing

User Table 
   Userid(p)
   UserName
   othercol..

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

hope this way you can easily fix the isse

这篇关于数据库设计1到1关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆