mercredi 16 décembre 2015

Entities Relationships on SQLite Java

I have a Java application that will create a database for a card game, id does havedifferent kind of entities, but some relates to each other, like:

Entity Creature, Rules, Equip, Magic. But any entity can have multiple rules, or none; also, any entity have the format attribute, is of the String type, but can have more than one (must be at least one). But I'm having trouble in how to create the table and in how to relate each other.

This is the statement I'm making:

String sqlStmt =    "CREATE TABLE Creature "+
                        "(NAME TEXT NOT NULL,"+
                        "COST TEXT NOT NULL,"+
                        "CMC INTEGET NOT NULL,"+
                        "CARDTEXT TEXT,"+
                        //Is set right?
                        "SET TEXT NOT NULL,"+
                        "CODE TEXT PRIMARY KEY NOT NULL,"+
                        "RARITY TEXT NOT NULL,"+
                        //How to make here?
                        "FORMAT ,"+
                        "FLAVORTEXT TEXT,"+
                        //And here?
                        "RULLINGS,"+
                        "ATK INT NOT NULL,"+
                        "DEF INT NOT NULL,"+
                        "RACE TEXT NOT NULL";                             

Aucun commentaire:

Enregistrer un commentaire