帮助数据库设计 [英] Help with Database Design

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

问题描述

您好!我是编程和设计数据库的新手,因此我无法准确地告诉搜索引擎我的意思是回答这个具体问题。如果你有任何转介到任何伟大的地方请。但是,我无法找到任何。


无论如何如此!我有一个我创建的数据库来跟踪我在英雄联盟中的游戏。在这个游戏中,你的冠军总共有6个项目位置。我想填写这些。所以我的设置是:

游戏表通过ID链接到冠军表。在这个游戏桌中,我有6个字段用于游戏中的6种可能的项目。对于我有3个表的项目(有3个不同级别的项目,所以这是有必要的)。现在我想让这三个表与游戏桌的6个字段相关。


这是完全可能还是我只是一个如意的思想家?

Hello! I am rather new at programming and designing databases, and am therefore unable to tell a search engine exactly what i mean to answer this specific question. Please if you have any referrals to anywhere that would be great. However, i was unable to find any.

Anyway so! I have a database I have created to track my games in League of Legends. In this game there are a total of 6 item slots on your champion. I want to fill these out. So my setup is:
Games table linked to a champion table by ID. Within this games table i have 6 fields for the 6 possible items there are in a game. For the items i have 3 tables (there are 3 different levels of items, so this is kinda required). NOW i want to have these three tables to be related to the 6 fields of the Games table.

Is this at all possible or am i just being a wishful thinker?

推荐答案

对于3个不同的项目层,您实际上并不需要3个表。我假设你想要这个,因为每个更高层的项目都是由较低层的项目组成的。


你只需要2个表,任何层数。一个表用于保存所有项目信息,另一个表用于保存成分信息。这些项目。


这意味着这6个字段只需要引用一个项目表。如果需要,该项目表可以参考成分表。


通常我建议不要将所有6个项目存储为单独的列。因为它会导致查询不灵活。例如,如果他们再添加一个项目槽,则意味着您构建的几乎所有查询都会发生变化。但在这个特殊情况下,我怀疑他们会做出任何这样的改变。
You don''t actually need 3 tables for the 3 different tiers of items. I assume you want this because each higher tier of item is composed of items from the lower tiers.

You only need 2 tables, for any amount of tiers. One table to hold all the item information, and another table to hold the "ingredients" of the items.

Which means that those 6 fields only need to reference the one item table. And that item table can reference the ingredients table if needed.

Normally I would recommend against storing all 6 items as separate columns. Because it leads to inflexibility in querying. For example, if they add one more item slot, it means a change in almost all the queries you build. But in this particular case, I doubt they will be making any such change.


由于所有成分也是物品,你只需要一个物品表。每个项目的级别是一个属性,而不是不同结构的原因。

冠军,就像项目一样,是一个有限的列表,可供选择和链接。


游戏表中唯一需要反映游戏的表格。这将包括用于该游戏的冠军的链接以及您在该游戏中最终得到的项目的六个链接。 在Game表中有一个GameItem表而不是Item属性链接是有意义的,但是仍然可以将这些链接保存在Game表中。

NB。 Item表应该包含反映产生项目所需的其他项目(如果有的话)以及成本的字段。
As all the ingredients are also items you only need a single item table. The level of each item is an attribute and not a reason for a different structure.

Champions, just like the items, are a finite list from which to choose and link to.

The only table you need to reflect your games is the Game table. This would include links to the champion used for that game as well as six links to the items you ended up with in that game. It would make sense to have a GameItem table instead of Item attribute links in your Game table, but it''s nevertheless possible to keep these links in the Game table itself.

NB. The Item table should include fields to reflect which other items, if any, are required to produce the item, as well as the cost.


我想一个简化的版本看起来像沿线一样

游戏桌
I imagine a pared down version looking something along the lines of

Game Table
展开 | 选择 | Wrap | 行号


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

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