CREATE TABLE "medals_table" (
  "rank" text,
  "nation" text,
  "gold" real,
  "silver" real,
  "bronze" real,
  "total" real
);

Question: What is the average total value for Spain?
SQL: SELECT AVG("total") FROM "medals_table" WHERE "nation"='spain';

Question: What is the sum of silvers for countries in rank 8 with totals over 3?
SQL: SELECT SUM("silver") FROM "medals_table" WHERE "rank"='8' AND "total">3;

Question: What is the average total for countries with under 3 golds and 0 silvers?
SQL: SELECT AVG("total") FROM "medals_table" WHERE "gold"<3 AND "silver"<0;