CREATE TABLE "locomotives" (
  "number" real,
  "builder" text,
  "type" text,
  "date" text,
  "works_number" text
);

Question: Which Works number has a Builder of canadian engine & machinery company, and a Number smaller than 3?
SQL: SELECT "works_number" FROM "locomotives" WHERE "builder"='canadian engine & machinery company' AND "number"<3;

Question: Which Works number has a Builder of avonside engine company, and a Type of 4-6-0, and a Number smaller than 12, and a Date of december 1871?
SQL: SELECT "works_number" FROM "locomotives" WHERE "builder"='avonside engine company' AND "type"='4-6-0' AND "number"<12 AND "date"='december 1871';

Question: Which Type has a Builder of avonside engine company, and a Number of 9?
SQL: SELECT "type" FROM "locomotives" WHERE "builder"='avonside engine company' AND "number"=9;

Question: Which Date has a Type of 4-6-0, and a Number larger than 11?
SQL: SELECT "date" FROM "locomotives" WHERE "type"='4-6-0' AND "number">11;

Question: Which Builder has a Date of early 1871?
SQL: SELECT "builder" FROM "locomotives" WHERE "date"='early 1871';