概念到关系的映射

发布于 2024-10-16 04:57:32 字数 906 浏览 6 评论 0原文

这是一个家庭作业问题。我已经有了自己的答案,但不确定是否正确,需要你们的建议。这是概念图:

-------------
| Employer  |
-------------------
| EmployerID, Name|
-------------------
    |
    |- supervise
    |
------------------           ---------------  ---------
| Running Project | ------- |Year, duration| | Project |
-------------------          --------------- -----------
    |                                        | ProjectID, ProjectName,|
    |- works                                 -------------------
    |
-------------
| Employees |
-------------
| EmpID, Name|
--------------

这是我的关系模式:

Employer(EmployerID, name) ->主键是 EmployerIDEmployees

(EmpID, name) ->主键是 EmpID

我认为雇主和雇员实体应该是正确的,就像它的正常类别一样。但是我不确定正在运行的项目和项目实体,即关联类和依赖类。这是我的答案:

RUNning Project (EmpID, Year, Duration, ProjectID, ProjectName) ->所有主键

Project(ProjectID, ProjectName) ->所有主键

this is a homework question. I already have my own answer, but I am not sure if its correct, need your guys advise. Here is the conceptual diagram:

-------------
| Employer  |
-------------------
| EmployerID, Name|
-------------------
    |
    |- supervise
    |
------------------           ---------------  ---------
| Running Project | ------- |Year, duration| | Project |
-------------------          --------------- -----------
    |                                        | ProjectID, ProjectName,|
    |- works                                 -------------------
    |
-------------
| Employees |
-------------
| EmpID, Name|
--------------

Here is my relational schema:

Employer(EmployerID, name) -> Primary key is EmployerID

Employees(EmpID, name) -> Primary key is EmpID

I think the employer and employees entity should be correct, as its normal class. BUt I am not sure the Running project and project entity, which is the association class and the dependent class. Here is my answer:

RUnning Project (EmpID, Year, Duration, ProjectID, ProjectName) -> all primary keys

Project(ProjectID, ProjectName) -> all primary keys

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

哑剧 2024-10-23 04:57:32

这是我从关系中了解到的,

  • 您有 3 个主要实体:雇主、员工、项目
  • 雇主属性:EmployerId、姓名
  • 员工属性:EmployeeId、姓名
  • 项目属性:ProjectId、姓名、持续时间、
  • 第一年雇主监督 多个项目。
  • 一名员工可以多个项目工作。

在这种情况下,可以识别 3 个根表:雇主、雇员和项目。用于关联根表的表有:

  • EmployerProject (EmployerId, ProjectId)
  • EmployeeProject (EmployeeId, ProjectId)

同样,我对 Project 表有一个建议,年份属性似乎是年份 (或日期)项目开始的时间。如果是,则 Duration 属性是派生属性 (CurrentDate - StartDate)。该派生属性不需要包含在表中。

Here is what I understood from the relationship,

  • You have 3 major entities: Employer, Employee, Project
  • Employer attributes: EmployerId, Name
  • Employee attributes: EmployeeId, Name
  • Project attributes: ProjectId, Name, Duration, Year
  • One employer supervises more than one projects.
  • One employee can work for more than one projects.

In that case, one can identify 3 root tables: Employer, Employee and Project. The tables that are used to relate the root tables are:

  • EmployerProject (EmployerId, ProjectId)
  • EmployeeProject (EmployeeId, ProjectId)

Again, I have a suggestion for the Project table, the year attribute seems to the year (or date) when the project was started. If so, then the Duration attribute is a derived attribute (CurrentDate - StartDate). This derived attribute need not be included in the table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文