I have a table in MySQL that has a list of number for 505 rows
1 2 3 4
------------------
A | 16 23 30 10
B 8 56 67 1
I am trying to divide each column by the last column and then deposit the results into a table of a similar format. I am a little lost on how to increment it. I have code that looks like this.
cursor.execute("select * from 'database'.'count'"
" where name =%s;", name)
logs = cursor.fetchall()
cursor.execute("INSERT INTO `database`.`averages`(`name`) "
"VALUES (%s) ON DUPLICATE KEY UPDATE "
"`1`=0, `2`=0, `3`=0, `4`=0, `5`=0, `6`=0,"
" `7`=0, `8`=0, `9`=0, `10`=0, `>10`=0,`-1`=0, `-2`=0, "
"`-3`=0, `-4`=0, `-5`=0, `-6`=0, `-7`=0, `-8`=0, "
"`-9`=0, `-10`=0, `<-10`=0;", name)
con.commit()
logs = [list (y) for y in logs]
from there I am drawing a blank on the best way to format the code, some sort of for loop comes to mind but is there a better way.