用户表和个人资料表之间的关系 [英] Relation between user table and profile table

查看:102
本文介绍了用户表和个人资料表之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家们.
我想建立一个简单的社交网络.我目前正在研究架构
现在,我已经创建了users表.但我不明白用户表和个人资料表之间的关系. !

Hi dear experts.
i want to build a simple social network .I''m currently working on the architecture
Now I''ve created the users table . but i can''t understand relation between users table and profile table . ! Whether their relationship is 1 to 1?

推荐答案

您希望用户拥有多少个人资料?

是一个用户,一个个人资料吗?
还是一个用户,许多个人资料?
一个用户还是多个用户?

该问题的答案就是您的答案.
How many profiles do you expect your users to have?

Is it one user, one profile?
Or one user, many profiles?
Or many users, one profile?

The answer to that question is the answer to yours...


您好,您有一个用户表和一个配置文件表.
一个用户有一个配置文件,并在配置文件表中引用了用户ID

在用户表中添加Userid作为主键-自动隐藏字段
使用此字段在配置文件表中使用外键,并使用联接查询可以从两个表中获取所有字段.
Hi, you have one user table and one profile table.
one user has one profile and reference of user id into profile table

add Userid as primary key in user table - auto increamented field
use this field make foreign key in profile table and using join queries you can fetch all fields from both the tables.


这篇关于用户表和个人资料表之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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