### Database Schema:
CREATE TABLE trains (
	id	INTEGER	NOT NULL	PRIMARY KEY,
	direction	TEXT	NULL	DEFAULT NULL
);

CREATE TABLE cars (
	id	INTEGER	NOT NULL	PRIMARY KEY,
	train_id	INTEGER	NULL	DEFAULT NULL,
	position	INTEGER	NULL	DEFAULT NULL,
	shape	TEXT	NULL	DEFAULT NULL,
	len	TEXT	NULL	DEFAULT NULL,
	sides	TEXT	NULL	DEFAULT NULL,
	roof	TEXT	NULL	DEFAULT NULL,
	wheels	INTEGER	NULL	DEFAULT NULL,
	load_shape	TEXT	NULL	DEFAULT NULL,
	load_num	INTEGER	NULL	DEFAULT NULL,
	foreign key (train_id) references trains (id)
);

### User's Query:
How many cars running east have double-sided tail cars?

### Extra Knowledge:
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'