Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql t、 稍后,您可以考虑是否希望强度和防御成为类型的属性(列);或者不是。等等 对11月30日至10日评论的答复_Mysql_Database - Fatal编程技术网

Mysql t、 稍后,您可以考虑是否希望强度和防御成为类型的属性(列);或者不是。等等 对11月30日至10日评论的答复

Mysql t、 稍后,您可以考虑是否希望强度和防御成为类型的属性(列);或者不是。等等 对11月30日至10日评论的答复,mysql,database,Mysql,Database,. 很好,你了解你的数据。正确的。现在我明白了为什么有一个属性表 请确保这10个例子具有代表性,我正在仔细研究它们 类型:宝石名称:Emberspark吊坠。。。或者,这是一种类型 Unique是真正的ItemType吗?我想不是 操作。显示“请返回季节组织者” AttackPower和HitRating的属性在哪里? 在我的产品集群示例中,有多少不同类型的项目(35000个)。另一种说法是,有多少种变体。我的意思是,有意义的是,不是3500项÷8项属性 物品属性是否会在不发布s/w的情况

.
很好,你了解你的数据。正确的。现在我明白了为什么有一个属性表

  • 请确保这10个例子具有代表性,我正在仔细研究它们

    • 类型:宝石名称:Emberspark吊坠。。。或者,这是一种类型
    • Unique是真正的ItemType吗?我想不是
    • 操作。显示“请返回季节组织者”
    • AttackPower
      HitRating
      的属性在哪里?
  • 在我的产品集群示例中,有多少不同类型的项目(35000个)。另一种说法是,有多少种变体。我的意思是,有意义的是,不是3500项÷8项属性

  • 物品属性是否会在不发布s/w的情况下发生变化(例如,新的
    内部强度
    属性)

  • 每个项目重复哪些属性(不止一个);到目前为止,我只看到了行动

  • 这是一个游戏,所以你需要一个紧凑且非常快速的数据库,可能是完全内存驻留的,对吧。没有空值。什么都没有。最短数据类型。不要复制任何东西(不要重复你自己)。你对位(布尔)和向量满意吗

  • 您是否需要轻松地将这些正则表达式转换为SQL,或者您对每一个正则表达式都进行了认真的工作(即,一旦您让它们在SQL中工作,它们就相当稳定,然后您就不会弄乱它,除非您发现一个bug)(没有讽刺,严肃的问题)

    6.1或者可能是另一种情况:数据库驻留在磁盘上;你把它载入内存一次;在游戏过程中,你在上面运行正则表达式;偶尔写入磁盘。因此,不需要将正则表达式转换为SQL

  • 这是一个我要去的地方的数据模型,这一点都不确定;它将被你的答案所调整。要明确的是:

    • 第六范式是该行由主键和最多一个属性组成。

    • 我画的是(6.1)而不是(6),因为您的数据强化了我的信念,即您需要一个纯6NF关系数据库

    • My是一个比EAV更好的示例,它是6NF,然后按数据类型再次标准化(不是在标准形式意义上),以减少表的数量,您已经看到了。(EAV用户通常会选择一张或几张巨大的桌子。)

    • 这是直线5NF,在6NF中只有右边的两个表格

    适用于那些不熟悉关系建模标准的人

    对编辑的答复#2005年12月10日 1.1。好的,更正了

    1.2。然后IsUnique是项的指示符(布尔值)

    1.3。行动。我理解。那你打算把它放在哪里

    1.4。Neck Miscellaneous表示项目同时属于
    Neck
    Misc
    两个类别。这意味着两个独立的
    项。Name=Emberspark Pendant
    ,每个项具有不同的类别

    .
    2.五,。因此,您确实需要快速内存驻留数据库。这就是为什么我想让你越过界限,离开GridLand,进入RelationalLand。
    .
    3.好的,我们使用第五范式,不需要6NF或产品集群(每个数据类型的表)。迄今为止,
    值都是整数。
    .
    4.我还可以看到:
    级别
    所需级别
    是唯一的
    BindsPickedUp
    BindsEquipped

    .
    5.位是布尔值{0 | 1}。(关系)投影需要向量。我们稍后会找到他们。
    .
    6.好的,您已经解释过了,您没有将正则表达式转换为SQL。(努力意味着艰苦的劳动)。 .
    7.什么是Category.ParentId?父类别?这以前从未出现过。
    .
    8.Attribute.generateId

    请评估数据模型(已更新)。除了你的专栏之外,我还有几个专栏。如果在数据模型中有什么您不理解的地方,请提出一个特定的问题。您已经阅读了注释文档,对吗

    我将
    Action
    作为一个表,其中
    ItemAction
    包含
    值:

    装备:增加28点攻击力
    动作。Name
    =
    增加攻击力
    物品动作。Value
    =28。

    您正在处理两个常见问题:

    • 彼此相似但不完全相同的实体(所有项目都有名称和描述,但不一定是智力)
    • 一种设计,在这种设计中,一旦数据库投入生产,就需要添加属性(您可以很容易地预测,在某个时候,您将需要添加属性,例如,对某些项目添加魔法抗性属性)
    通过重新设计EAV系统,将属性名和值存储为数据,您已经解决了问题。您重新发现了这个系统的一些问题(类型检查、关系完整性)


    在这种情况下,我个人会选择一个介于关系解决方案和EAV解决方案之间的解决方案。我会将公共列作为列添加到items表中,或者,如果items表示各种项目,而不是单个项目,则添加到items\u owners表中。这些列将包括描述和可能的类型,在您给出的示例中,这些列与文本列非常匹配。然后,我会保留那些数值评级属性的现有布局,使值类型为int。这样可以在整数属性之间进行类型检查和适当的规范化(您不会存储大量空值),而牺牲偶尔出现的空类型或描述。

    感谢您的快速响应,添加某种通用属性的想法,例如
    type
    description
    items itemId | itemName ------------------- 0001 | chest piece 0002 | sword 0003 | helmet attributes (attribute lookup table) attributeId | attributeName --------------------------------- 01 | strength 02 | agility 03 | intellect 04 | defense 05 | damage 06 | mana 07 | stamina 08 | description 09 | type item_attributes (junction table) itemId | attributeId | value (mixed type, bad?) ------------------------------------ 0001 | 01 | 35 0001 | 03 | 14 0001 | 09 | armor 0001 | 08 | crafted by awesome elves 0002 | 09 | weapon 0002 | 05 | 200 0002 | 02 | 15 0002 | 08 | your average sword 0003 | 04 | 9000 0003 | 09 | armor 0003 | 06 | 250 attributes (attribute lookup table) attributeId | attributeName | data_type --------------------------------------------------- 01 | strength | int 09 | type | char 08 | intellect | varchar item_attributes (junction table) itemId | attributeId | value | int | char | varchar ------------------------------------------------------------------------ 0002 | 09 | weapon | null |weapon| null 0002 | 05 | 200 | 200 | null | null 0002 | 02 | 15 | 15 | null | null 0002 | 08 | your average sword | null | null | your average sword -------------------------------------- http://wow.allakhazam.com/ihtml?27718 Aldor Defender's Legplates Binds when picked up LegsPlate 802 Armor +21 Strength +14 Agility +21 Stamina Item Level 99 Equip: Improves hit rating by 14. -------------------------------------- http://wow.allakhazam.com/ihtml?17967 Refined Scale of Onyxia Leather Item Level 60 -------------------------------------- http://wow.allakhazam.com/ihtml?27719 Aldor Leggings of Puissance Binds when picked up LegsLeather 202 Armor +15 Agility +21 Stamina Item Level 99 Equip: Increases attack power by 28. Equip: Improves hit rating by 20. -------------------------------------- http://wow.allakhazam.com/ihtml?5005 Emberspark Pendant Binds when equipped NeckMiscellaneous +2 Stamina +7 Spirit RequiresLevel30 Item Level 35 -------------------------------------- http://wow.allakhazam.com/ihtml?23234 Blue Bryanite of Agility Gems RequiresLevel2 Item Level 10 +8 Agility -------------------------------------- http://wow.allakhazam.com/ihtml?32972 Beer Goggles Binds when picked up Unique HeadMiscellaneous Item Level 10 Equip: Guaranteed by Belbi Quikswitch to make EVERYONE look attractive! -------------------------------------- http://wow.allakhazam.com/ihtml?41118 Gadgetzan Present Binds when picked up Unique Item Level 5 "Please return to a Season Organizer" -------------------------------------- http://wow.allakhazam.com/ihtml?6649 Searing Totem Scroll Unique Quest Item RequiresLevel10 Item Level 10 Use: -------------------------------------- http://wow.allakhazam.com/ihtml?6648 Stoneskin Totem Scroll Unique Quest Item RequiresLevel4 Item Level 4 Use: -------------------------------------- http://wow.allakhazam.com/ihtml?27864 Brian's Bryanite of Extended Cost Copying Gems Item Level 10 gem test enchantment -------------------------------------- select * from itemattributestat where item_itemId=251 item_itemId | attribute_attributeId | value | listOrder ======================================================= '251', '9', '0', '1' '251', '558', '0', '2' '251', '569', '0', '3' '251', '4', '802', '4' '251', '583', '21', '5' '251', '1', '14', '6' '251', '582', '21', '7' '251', '556', '99', '8' '251', '227', '14', '9' create view itemDetail as select Item_itemId as id, i.name as item, a.name as attribute, value from ((itemattributestat join item as i on Item_itemId=i.itemId) join attribute as a on Attribute_attributeId=a.attributeId) order by Item_itemId asc, listOrder asc; select * from itemdetail where id=251; id | item | attribute | value '251', 'Aldor Defender''s Legplates', 'Binds when picked up', '0' '251', 'Aldor Defender''s Legplates', 'Legs', '0' '251', 'Aldor Defender''s Legplates', 'Plate', '0' '251', 'Aldor Defender''s Legplates', 'Armor', '802' '251', 'Aldor Defender''s Legplates', 'Strength', '21' '251', 'Aldor Defender''s Legplates', 'Agility', '14' '251', 'Aldor Defender''s Legplates', 'Stamina', '21' '251', 'Aldor Defender''s Legplates', 'Item Level', '99' '251', 'Aldor Defender''s Legplates', 'Equip: Improves hit rating by @@.', '14'