CREATE TABLE "locomotives" (
  "number" real,
  "locomotive_type" text,
  "wheel_arrangement" text,
  "builder" text,
  "entered_service" real,
  "withdrawn" real
);

Question: When did the tom smith built train enter service with a number under 7007?
SQL: SELECT AVG("entered_service") FROM "locomotives" WHERE "builder"='tom smith' AND "number"<7007;