I am new to MySQL. I am making a table with athletes (name as primary key) and their running times.
In the last training session Tom record was 32 m 46 s and Joe record was 34 m 33 s.
I need a statement (I am using Python) to update the table in order to add the new times in the first available cell the schematic of the table is the following:
Name G1 G2 G3
---------------------------------
Tom 33m21s 31m54s null
Joe 35m03s null null
Therefore for Tom the time should go in column G3, and for Joe in column G2.
The table should look like this:
Name G1 G2 G3
----------------------------------
Tom 33m21s 31m54s 32m46s
Joe 35m03s 34m33s null
I am trying to make this task as automated as possible so I do not want to specify each time in which column the new time should go.
I have tried this code but I have to specify the column each time: I do not know what to insert after "SET"
sqlMP = "UPDATE time SET ... WHERE player = %s AND G1 IS NULL"
Thanks for the help
G3column already have some value?