CREATE TABLE sale(Mont INT, sales INT) LOAD DATA INFILE "moving_avg.csv" INTO TABLE sale FIELDS TERMINATED BY "," SELECT Mont,avgs(3,sales) FROM sale ASSUMING ASC Mont INTO OUTFILE "moving_avg_output.csv" FIELDS TERMINATED BY ";" select Mont, mins(2,sales) from sale assuming desc Mont group by sales into outfile "flatten.csv"