How many cars running east have double-sided tail cars?
east is an direction; double-sided refers to sides = 'double'; tail refers to carsposition = trailPosi
SELECT COUNT(T1.id) FROM trains AS T1 INNER JOIN cars AS T2 ON T1.id = T2.train_id INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T3 ON T1.id = T3.train_id WHERE T1.direction = 'east' AND T2.position = T3.trailPosi AND T2.sides = 'double'
database name:db_id trains
cars table cars Cols: id dtype integer, train id dtype integer, position dtype integer, shape dtype text, length dtype text, sides dtype text, roof dtype text, wheels dtype integer, load_shape dtype text, load number dtype integer, 
trains table trains Cols: id dtype integer, direction dtype text, 
