# Database design : xml or relational

This topic is 4953 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I am working on a project in C++ that uses more complicated data than I have ever used before. I am looking for some helping in chosing the right type of database. I am mostly looking into XML and relational databases (or some kind of hybrid). The data is stored locally. It doesn't need to be modified (at least not by the user). However, I will be updating the data for everyone on a regular basis. The first problem I am having with it is that it is semi-structured. For instance, in a database of spells (i'm not working on a game, but a program about a game), each spell will have some structed elements, such as the name of the skill and its casting cost, but each skill will a varied number and type of effects.
<Spells>
<Spell>
<SkillName>Flame</SkillName>
<CastingCost>10 Energy</CastingCost>
<Effect>
<EffectType>Direct Dmg</EffectType>
... other aspects of Effect1...
</Effect>
<Effect>
<EffectType>Incendiary</EffectType>
... other aspects of Effect2...
</Effect>
</Spell>

<Spell>
<SpellName>Heal</SpellName>
<Effect>
<EffectType>Heal Self</EffectType>
... other aspects of Effect1...
</Effect>
</Spell>
</Spells>


Each skill has a varied number of effects. The number and type of elements characteristic of each effect type vary widely. I am new to relational modeling, but I can not see how this can be effeciently modeled in a relational database. So, I have been inteding to use XML. However, the second problem is that the data will need to be queryed and resorted in many different ways. SQL would do the job very well. I have thought about using sqlite for a relational database, or DBXML for an xml database. Anybody have any suggestions about how to best store and access the data?

##### Share on other sites
For a relational db design you'll end up having several tables with only a couple of fields each. Something like this:
SpellTypesTable---------------ID : autoincrName : stringEffectTypesTable----------------ID : autoincrType : stringAspectsTable------------ID : autoincrName : stringValue : numberEffectAspectsTable------------------Effect_ID : numberAspect_ID : numberSpellEffectsTable-----------------Spell_ID : numberEffect_ID : number

• 11
• 20
• 12
• 10
• 35
• ### Forum Statistics

• Total Topics
631399
• Total Posts
2999857
×