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

Question: With a works number of 40864 for the builder of Baldwin Locomotive Works, the number listed is?
SQL: SELECT "number" FROM "locomotives" WHERE "builder"='baldwin locomotive works' AND "works_number"=40864;

Question: Builder H. K. Porter, inc who had a type of 0-4-4 Forney locomotive, has what works number?
SQL: SELECT "works_number" FROM "locomotives" WHERE "type"='0-4-4 forney locomotive' AND "builder"='h. k. porter, inc';

Question: Baldwin Locomotive Works, also with works number 40864, is listed as what number?
SQL: SELECT "number" FROM "locomotives" WHERE "builder"='baldwin locomotive works' AND "works_number"=40864;

Question: Hinkley Locomotive Works is listed as what number as it has a works number smaller than 1563?
SQL: SELECT "number" FROM "locomotives" WHERE "works_number"<1563 AND "builder"='hinkley locomotive works';