Table: san_marino_1986_grand
Columns: driver
constructor
laps
time_retired
grid

Question: What is the grid total that had a retired for engine, teo fabi driving, and under 39 laps?
SQL: SELECT SUM("grid") FROM san_marino_1986_grand WHERE "time_retired" = 'engine' AND "driver" = 'teo fabi' AND "laps" < 39

Question: What is the average grid for johnny dumfries with less than 8 laps?
SQL: SELECT AVG("grid") FROM san_marino_1986_grand WHERE "driver" = 'johnny dumfries' AND "laps" < 8

Question: What is the low lap total for minardi - motori moderni, and a Grid smaller than 18?
SQL: SELECT MIN("laps") FROM san_marino_1986_grand WHERE "constructor" = 'minardi - motori moderni' AND "grid" < 18

Question: What constructor has a 12 grid?
SQL: SELECT "constructor" FROM san_marino_1986_grand WHERE "grid" = 12