数据库设计:OR关系 [英] Database design: OR relation

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

问题描述

我有一个包含有关我的用户数据的users表的数据库。每个用户都要链接到公司或大学。我希望有两个单独的表学院和公司,每个都有一个字段ID。那么如何将users表中的每条记录链接到公司或大学?

I have a database with a "users" table containing data about my users. Each user is to be linked to a company or a college. I wish to have two separate tables "college" and "company" each with a field "ID". So how do I link each record in the users table to either a company or a college?

基本的是我希望在数据库中建立一个OR关系。

The basic thing is that I wish to establish an "OR" relationship in the database.

推荐答案

您可以使用子类型/超类型关系。将所有常见字段保留在组织表格中。 学院公司表格只包含特定于这些实体的字段。

You can use subtype/super-type relationship. Keep all common fields in the organization table. College and company tables contain only fields specific to those entities.

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

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