For my Game App, I have a table of Data (one of many)in CSV format. It currently has 40+ columns, one for each Profession (fighter, rogue, wizard etc), and skill_name.
Each row (40+) contains the skill name, and a String representing the Cost of that skill for each profession.
A snippet from the original .csv contains data as shown here:
Skill,Fighter,Thief,Rogue
Armor-Heavy,2,4,3
Armor-Light,1,2,1
Armor-Medium,2,3,2
To enter this into a normalised database, I should have a Profession List table, a Skill List table, and a skill_costs_by_profession table.
I have built and populated the skill list and profession list tables:
CREATE TABLE "skills" ("_id" INTEGER, "skill" TEXT)
CREATE TABLE "professions" ("_id" INTEGER, "profession" TEXT)
I can create a table to hold the normalised data:
CREATE TABLE "skillCostByProfession" ("skill_id" INTEGER, "profession_id" INTEGER, "cost" INTEGER)
skillCostByProfession will have the data organised:
profession_id, skill_id, cost
1 | 1 | 2 (Fighter, Armor-Heavy, cost (2))
1 | 2 | 1 (Fighter, Armor-Light, cost (1))
1 | 3 | 2 (Fighter, Armor-Medium, cost (2))
2 | 1 | 4 (Thief, Armor-Heavy, cost (4))
2 | 2 | 2 (Thief, Armour-Light, cost (2))
2 | 3 | 3 (Thief, Armour-Medium, cost (3))
3 | 1 | 3 (Rogue, Armor-Heavy, cost (3))
3 | 2 | 1 (Rogue, Armour-Light, cost (1))
3 | 3 | 2 (Rogue, Armour-Medium, cost (2))
etc
I am struggling to find a way to put the data from the original .csv into the new skillCostByProfession table
I am using a combination of LibreOffice Calc and DB Browser (SQLite), to prepare the database for my Android App.
How can I convert the table of data I have into the format that I need, without writing the 1600 rows by hand?