如何在表格中表示这一点?

发布于 2024-10-13 05:02:45 字数 684 浏览 3 评论 0原文

我有一个像这样的数据集合

Programme title |  Episode  |  Subtitle  |  Performers  |  Description

最初我将其标准化为两个表,所以

PROGRAMME

progid  |  progtitle  |  description

EPISODE

epid  |  progid  |  episode  |  subtitle  |  description

我想我想在另一个表中表示表演者,但不确定如何表示它。据我所知,存在以下关系

  • 一对多:一个节目可以有许多表演者
  • 一对多:一个表演者可以在许多节目中出现

我不确定如何表示这一点?

编辑啊,我明白了,所以我实际上会有这样的表格?

PERFORMER

performerid  |  performer

PROGRAMME

progid  |  progtitle  |  description

EPISODE

epid  |  progid  |  episode  |  subtitle  |  description

PROG_PERFORMER

progid  |  performerid

I have a collection of data like so

Programme title |  Episode  |  Subtitle  |  Performers  |  Description

Initially I normalised this into two table like so

PROGRAMME

progid  |  progtitle  |  description

EPISODE

epid  |  progid  |  episode  |  subtitle  |  description

I'm thinking I'd like to represent the performers in another table though, but not sure how to represent it. From what I can tell the following relationships exist

  • One to Many: A programme can have many performers
  • One to Many: A performer could feature in many programmes

I'm not sure how I would represent this?

EDIT Ah I see so I'd actually have tables like this for example?

PERFORMER

performerid  |  performer

PROGRAMME

progid  |  progtitle  |  description

EPISODE

epid  |  progid  |  episode  |  subtitle  |  description

PROG_PERFORMER

progid  |  performerid

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

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

发布评论

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

评论(3

瀞厅☆埖开 2024-10-20 05:02:45

此外,表演者可以在剧集之间更换

Also, performers can change between episodes

不弃不离 2024-10-20 05:02:45

这是多对多。一名表演者可以参与多个节目,一个节目可以有多个表演者。

网络上(以及教科书中)有大量关于建立多对多关系的信息。其中一个资源如下:

http:// /www.tekstenuitleg.net/en/articles/software/database-design-tutorial/many-to-many.html

确实,虽然应该是

  • 一个程序与剧集有一对多关系
  • 一个剧集有一个与表演者的多对多关系。

这足以创建一个列出所有表演者/节目/剧集关系的查询。

It's many-to-many. One performer can be in multiple programs, and one program can have multiple performers.

There's plenty of information on the net (and in textbooks) about setting up many-to-may relationships. One such resource is here:

http://www.tekstenuitleg.net/en/articles/software/database-design-tutorial/many-to-many.html

Really, though it should be

  • A Program has a one-many relationship with episodes
  • An episode has a many-many relationship with performers.

This is enough to create a query that will list all performer/show/episode relationships.

旧情别恋 2024-10-20 05:02:45

除了执行者表之外,您还必须创建一个关系表

执行者表

performerid | name | ...

关系表

performerid | progid

beside performer table you have to create a relation table

performer table

performerid | name | ...

relation table

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