CREATE TABLE "scotland" (
  "constituency" text,
  "candidate" text,
  "affiliation" text,
  "votes_cast" real,
  "result_pct" text,
  "loss_gain" text
);

Question: What was the loss/gain when the votes -cast was 166?
SQL: SELECT "loss_gain" FROM "scotland" WHERE "votes_cast"=166;

Question: Who as the candidate when the result - % was 2.9%?
SQL: SELECT "candidate" FROM "scotland" WHERE "result_pct"='2.9%';

Question: How many votes were cast when the constituency was midlothian?
SQL: SELECT "votes_cast" FROM "scotland" WHERE "constituency"='Midlothian';

Question: Who was the candidate when the result - % was 0.4%?
SQL: SELECT "candidate" FROM "scotland" WHERE "result_pct"='0.4%';

Question: What was the loss/gain when the affiliation was solidarity?
SQL: SELECT "loss_gain" FROM "scotland" WHERE "affiliation"='Solidarity';