En ese caso este seria el query en el primer caso
a) mileage = 100.9
b) litters = 10
c) efficiency = 0
En el registro 2
a) mileage = 200
b) litters = 11
c) efficiency = (200-(SELECT mileage from demo2 order by id desc limit 1))/11 ==> equivalente a 9.00909090909091
En el registro3
a) mileage = 500
b) litters = 15
c) efficiency = (500-(SELECT mileage from demo2 order by id desc limit 1))/15 ==> equivalente a 20
Los querys son los siguientes:
1)
INSERT INTO demo2 (mileage, litters,efficiency) VALUES (100.9,10,0);
2)
INSERT INTO demo2 (mileage, litters,efficiency) VALUES (200,11,
(200-(SELECT mileage from demo2 order by id desc limit 1))/11
);
3)
INSERT INTO demo2 (mileage, litters,efficiency) VALUES (500,15,
(500-(SELECT mileage from demo2 order by id desc limit 1))/15
);