Skip to main content
added 8 characters in body
Source Link
Coyote
  • 3.2k
  • 1
  • 20
  • 35

1 No... At least not how I would have done it. It might be exactly what you need, but I doubt it will scaledon't really see the logics.

2 Yes a few. For example:

  • Your user stash violates 1NF principles: Should not have multiple columns for storing the same data domain (but it's not the most important thing).
  • Your shopItems is not efficient if each item isn't composed exactly of an armor, a one handed weapon and a two-handed weapon. Which is not the case presuming on handed weapons are not always 2 handed and the other way round.

3 You should probably change your data structure or use a more dynamic storage system (XML, JSON...) where you could do a few things that are not practical with SQL.

<shop id="45u2y">
  <items>
    <item id="broad2">
    ...
  </item>
</shop>

<items>
  <item id="broad2">
    <name lang="en">Broad Sword</name>
    <transform id="twoHanded"><dmg type="cut">3d6+2</dmg><slot id="hand"/><slot id="hand"/></transform>
    <transform id="oneHanded"><dmg type="cut">2d6</dmg><slot id="hand"/></transform>
  </item>
</item>

4 If I had to use SQL I would probably do something like that:

shopItems
 shopItemId, shopItemStatus

items
 itemId, itemName, itemCathegory

itemsTransformators
 itemId, transformatorId, transformatorType, transformatorCondition

Etc... In this case I really believe SQL is not the best bet. I would definitely use a custom storage system, XML or if really needed another type of DB. ex: eXistDB http://exist.sourceforge.net/

1 No... At least not how I would have done it. It might be exactly what you need, but I doubt it will scale.

2 Yes a few. For example:

  • Your user stash violates 1NF principles: Should not have multiple columns for storing the same data domain (but it's not the most important thing).
  • Your shopItems is not efficient if each item isn't composed exactly of an armor, a one handed weapon and a two-handed weapon. Which is not the case presuming on handed weapons are not always 2 handed and the other way round.

3 You should probably change your data structure or use a more dynamic storage system (XML, JSON...) where you could do a few things that are not practical with SQL.

<shop id="45u2y">
  <items>
    <item id="broad2">
    ...
  </item>
</shop>

<items>
  <item id="broad2">
    <name lang="en">Broad Sword</name>
    <transform id="twoHanded"><dmg type="cut">3d6+2</dmg><slot id="hand"/><slot id="hand"/></transform>
    <transform id="oneHanded"><dmg type="cut">2d6</dmg><slot id="hand"/></transform>
  </item>
</item>

4 If I had to use SQL I would probably do something like that:

shopItems
 shopItemId, shopItemStatus

items
 itemId, itemName, itemCathegory

itemsTransformators
 itemId, transformatorId, transformatorType, transformatorCondition

Etc... In this case I really believe SQL is not the best bet. I would definitely use a custom storage system, XML or if really needed another type of DB. ex: eXistDB http://exist.sourceforge.net/

1 No... At least not how I would have done it. It might be exactly what you need, but I don't really see the logics.

2 Yes a few. For example:

  • Your user stash violates 1NF principles: Should not have multiple columns for storing the same data domain (but it's not the most important thing).
  • Your shopItems is not efficient if each item isn't composed exactly of an armor, a one handed weapon and a two-handed weapon. Which is not the case presuming on handed weapons are not always 2 handed and the other way round.

3 You should probably change your data structure or use a more dynamic storage system (XML, JSON...) where you could do a few things that are not practical with SQL.

<shop id="45u2y">
  <items>
    <item id="broad2">
    ...
  </item>
</shop>

<items>
  <item id="broad2">
    <name lang="en">Broad Sword</name>
    <transform id="twoHanded"><dmg type="cut">3d6+2</dmg><slot id="hand"/><slot id="hand"/></transform>
    <transform id="oneHanded"><dmg type="cut">2d6</dmg><slot id="hand"/></transform>
  </item>
</item>

4 If I had to use SQL I would probably do something like that:

shopItems
 shopItemId, shopItemStatus

items
 itemId, itemName, itemCathegory

itemsTransformators
 itemId, transformatorId, transformatorType, transformatorCondition

Etc... In this case I really believe SQL is not the best bet. I would definitely use a custom storage system, XML or if really needed another type of DB. ex: eXistDB http://exist.sourceforge.net/

Source Link
Coyote
  • 3.2k
  • 1
  • 20
  • 35

1 No... At least not how I would have done it. It might be exactly what you need, but I doubt it will scale.

2 Yes a few. For example:

  • Your user stash violates 1NF principles: Should not have multiple columns for storing the same data domain (but it's not the most important thing).
  • Your shopItems is not efficient if each item isn't composed exactly of an armor, a one handed weapon and a two-handed weapon. Which is not the case presuming on handed weapons are not always 2 handed and the other way round.

3 You should probably change your data structure or use a more dynamic storage system (XML, JSON...) where you could do a few things that are not practical with SQL.

<shop id="45u2y">
  <items>
    <item id="broad2">
    ...
  </item>
</shop>

<items>
  <item id="broad2">
    <name lang="en">Broad Sword</name>
    <transform id="twoHanded"><dmg type="cut">3d6+2</dmg><slot id="hand"/><slot id="hand"/></transform>
    <transform id="oneHanded"><dmg type="cut">2d6</dmg><slot id="hand"/></transform>
  </item>
</item>

4 If I had to use SQL I would probably do something like that:

shopItems
 shopItemId, shopItemStatus

items
 itemId, itemName, itemCathegory

itemsTransformators
 itemId, transformatorId, transformatorType, transformatorCondition

Etc... In this case I really believe SQL is not the best bet. I would definitely use a custom storage system, XML or if really needed another type of DB. ex: eXistDB http://exist.sourceforge.net/