How many total medals does rank 3 with less than 40 silver medals?
CREATE TABLE "top_ten_medals" (
  "rank" real,
  "province" text,
  "gold" real,
  "silver" real,
  "bronze" real,
  "total" real
);
SELECT MAX("total") FROM "top_ten_medals" WHERE "silver"<40 AND "rank"=3;