View Single Post
Old 01-16-2019, 04:12 PM   #8
cavebutter
All Star Starter
 
cavebutter's Avatar
 
Join Date: Dec 2005
Location: Los Angeles
Posts: 1,158
Quote:
Originally Posted by Sharkn20 View Post
Trying to learn how to use effectively .csv files, from where do you recommend me to start? Any useful books? Maybe Excel for Dummies will teach me?? Or MySQL?
I would like to track mainly changes in ratings in OOTP and FOF, thanks in advance

Sent from my SM-G960F using Tapatalk
Last post on this thread, I promise - but feel free to PM me with any other questions.

Tracking ratings over time is really difficult outside of the game. That's because the dump does not include ratings history. It can be done, but it takes some work.

The inelegant way is to create a table called ratings_year where year is the game year that you dumped the data. Create a new table every game year and join them on player_id.

The more elegant way would be to create a single ratings table and write a script in SQL that takes the annual ratings dump, creates a temporary table from it, adds a game_year column to it, inserts it to your single ratings table, and deletes the temp table.

Just taking a stab at it here, it would look something like this:

Code:
CREATE TEMPORARY TABLE ratings_temp LIKE ratings;
LOAD DATA LOCAL INFILE 'filepath/ratings.csv'
INTO TABLE ratings_temp
FIELDS TERMINATED BY ',';

INSERT INTO  ratings (game_year, field1, field2, fieldn)
    SELECT 2018 as 'game_year', field1, field2, fieldn
    FROM ratings_temp;

DROP TEMPORARY TABLE ratings_temp;
You'd only have to update the game year value (bolded above) each time you ran the script.
__________________
MySQL, MyStruggle - A self-indulgent blog about my attempts to roll my own MySQL Database with OOTP

Logo Gallery

Last edited by cavebutter; 01-16-2019 at 05:27 PM.
cavebutter is offline   Reply With Quote